compose-richtext icon indicating copy to clipboard operation
compose-richtext copied to clipboard

Provide a way to have custom link click handling

Open Queatz opened this issue 10 months ago • 2 comments

I want to make clicking a link give the user the option to copy it to clipboard or open it.

Queatz avatar Mar 01 '25 07:03 Queatz

I'm also interested by this, to disable opening links in a certain situation. I would be happy to contribute, but i don't know how to import the library in my project locally.

wiiznokes avatar May 21 '25 15:05 wiiznokes

you might choose the use this (picked from the example folder)

@Composable
fun ProvideToastUriHandler(context: Context, content: @Composable () -> Unit) {
  val uriHandler = remember(context) {
    object : UriHandler {
      override fun openUri(uri: String) {
        Toast.makeText(context, uri, Toast.LENGTH_SHORT).show()
      }
    }
  }

  CompositionLocalProvider(LocalUriHandler provides uriHandler, content)
}

tho it does not works well for me because i would like to make links just not clickable

wiiznokes avatar May 21 '25 16:05 wiiznokes