From 65eb06b2256843e3bb2d8ad6b55fa7ff0215cecb Mon Sep 17 00:00:00 2001 From: Mohamed Rejeb <41842296+MohamedRejeb@users.noreply.github.com> Date: Sat, 3 Feb 2024 08:35:06 +0100 Subject: [PATCH] Update links.md --- docs/links.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/links.md b/docs/links.md index 0c6a129c..956ec039 100644 --- a/docs/links.md +++ b/docs/links.md @@ -15,4 +15,20 @@ To get if the current selection is a link, use `RichTextState.isLink`: ```kotlin // Get if the current selection is a link. val isLink = richTextState.isLink -``` \ No newline at end of file +``` + +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: + +```kotlin +val myUriHandler by remember { + mutableStateOf(object : UriHandler { + override fun openUri(uri: String) { + // Handle the clicked link however you want + } + }) +} +CompositionLocalProvider(LocalUriHandler provides myUriHandler) { + RichText( ... ) +} +```