diff options
Diffstat (limited to 'widget/src/text/rich.rs')
-rw-r--r-- | widget/src/text/rich.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/widget/src/text/rich.rs b/widget/src/text/rich.rs index 625ea089..05ad6576 100644 --- a/widget/src/text/rich.rs +++ b/widget/src/text/rich.rs @@ -161,6 +161,15 @@ where self } + /// Sets the message handler for link clicks on the [`Rich`] text. + pub fn on_link_maybe( + mut self, + on_link: Option<impl Fn(Link) -> Message + 'a>, + ) -> Self { + self.on_link = on_link.map(|on_link| Box::new(on_link) as _); + self + } + /// Sets the default style class of the [`Rich`] text. #[cfg(feature = "advanced")] #[must_use] |