diff options
author | 2024-07-21 12:45:05 +0200 | |
---|---|---|
committer | 2024-07-21 12:45:05 +0200 | |
commit | 9bfaf2840cffe35d689bd115a308d21961ab082a (patch) | |
tree | c9a7b4fc04607c3315dabe3ad2527251b0a3dff8 /examples/markdown | |
parent | 4b44079f34aa9e01977a7974e5f49ae79ff6cd90 (diff) | |
download | iced-9bfaf2840cffe35d689bd115a308d21961ab082a.tar.gz iced-9bfaf2840cffe35d689bd115a308d21961ab082a.tar.bz2 iced-9bfaf2840cffe35d689bd115a308d21961ab082a.zip |
Add `Link` support to `rich_text` widget
Diffstat (limited to 'examples/markdown')
-rw-r--r-- | examples/markdown/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/markdown/src/main.rs | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/examples/markdown/Cargo.toml b/examples/markdown/Cargo.toml index 9404d5d2..cb74b954 100644 --- a/examples/markdown/Cargo.toml +++ b/examples/markdown/Cargo.toml @@ -8,3 +8,5 @@ publish = false [dependencies] iced.workspace = true iced.features = ["markdown", "highlighter", "debug"] + +open = "5.3" diff --git a/examples/markdown/src/main.rs b/examples/markdown/src/main.rs index 6b7adc12..bb6eb57b 100644 --- a/examples/markdown/src/main.rs +++ b/examples/markdown/src/main.rs @@ -16,6 +16,7 @@ struct Markdown { #[derive(Debug, Clone)] enum Message { Edit(text_editor::Action), + LinkClicked(String), } impl Markdown { @@ -50,6 +51,9 @@ impl Markdown { .collect(); } } + Message::LinkClicked(link) => { + let _ = open::that(link); + } } } @@ -60,7 +64,7 @@ impl Markdown { .padding(10) .font(Font::MONOSPACE); - let preview = markdown(&self.items); + let preview = markdown(&self.items, Message::LinkClicked); row![editor, scrollable(preview).spacing(10).height(Fill)] .spacing(10) |