Skip to content

Commit

Permalink
Update links.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedRejeb authored Feb 3, 2024
1 parent 8e3161c commit 65eb06b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
```

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( ... )
}
```

0 comments on commit 65eb06b

Please sign in to comment.