Add links¶
- To add links,
RichTextState
providesaddLink
method:
// Add link after selection.
richTextState.addLink(
text = "Compose Rich Editor",
url = "https://github.com/MohamedRejeb/Compose-Rich-Editor"
)
- To add link to the selected text,
RichTextState
providesaddLinkToSelection
method:
- To update link URL,
RichTextState
providesupdateLink
method:
- To remove links,
RichTextState
providesremoveLink
method:
- To get if the current selection is a link, use
RichTextState.isLink
:
- To get the current link text, use
RichTextState.selectedLinkText
:
- To get the current link URL, use
RichTextState.selectedLinkUrl
:
By default, links will be opened by your platform's UriHandler
, if however you want to handle the links on your own, you can override the composition local as such: