From 65b525af7ff2823cfe635c4b26d33aad9068e392 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 21 Jul 2024 20:00:02 +0200 Subject: Introduce `markdown::Settings` --- widget/src/text/rich.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'widget/src/text/rich.rs') 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 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] -- cgit