Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedRejeb authored Feb 3, 2024
1 parent 247b638 commit 8e3161c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ To get if the current selection is a link, use `RichTextState.isLink`:
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( ... )
}
```

#### Add Code Blocks

To add code blocks, `RichTextState` provides `toggleCodeSpan` method:
Expand Down Expand Up @@ -188,4 +204,4 @@ val markdown = richTextState.toMarkdown()
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.

0 comments on commit 8e3161c

Please sign in to comment.