Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Link support to rich_text widget #2512

Merged
merged 5 commits into from
Jul 21, 2024
Merged

Add Link support to rich_text widget #2512

merged 5 commits into from
Jul 21, 2024

Conversation

hecrj
Copy link
Member

@hecrj hecrj commented Jul 21, 2024

This PR introduces hyperlink support to the rich_text and span widgets.

The link type is generic; so you do not necessarily need to rely on strings for your links:

enum Message {
    LinkClicked(Link)
}

enum Link {
    Rust,
    Iced,
}

rich_text![
    "Here are 2 links: ",
    span("Rust").link(Link::Rust),
    " and ",
    span("Iced").link(Link::Iced)
]
.on_link(Message::LinkClicked)

The markdown widget does use strings as links, for obvious reasons.

@hecrj hecrj added feature New feature or request text widget addition labels Jul 21, 2024
@hecrj hecrj added this to the 0.13 milestone Jul 21, 2024
Copy link
Member

@tarkah tarkah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@hecrj hecrj merged commit 5443e4d into master Jul 21, 2024
24 checks passed
@hecrj hecrj deleted the feature/rich-text-links branch July 21, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants