halilozercan / compose-richtext

A collection of Compose libraries for advanced text formatting and alternative display types.
https://halilibo.com/compose-richtext
Apache License 2.0
787 stars 65 forks source link

Fixes linkClickHandler not working in inner uses of BasicRichText. #140

Open vitorpamplona opened 5 months ago

vitorpamplona commented 5 months ago

linkClickHandler is not passing around when new BasicRichTexts are instantiated.

I am not sure if this is the correct way of solving it, but this applies the same LocalLinkClickHandler to the entire hierarchy of nodes, not just the first level. It seems better than passing it around to new instances of BasicRichTexts.

FYI, in the demo, the click worked but wasn't handled by the custom handler. It was using the default LocalUriHandler.current.

halilozercan commented 5 months ago

First of all thanks for finding this out. I believe there is a simpler solution to this problem that doesn't require us exposing a CompositionLocal.

vitorpamplona commented 5 months ago

Frankly, I am not sure a custom handler is needed. I have specific needs to intercept it, but maybe the average user is ok on having just the LocalUriHandler.current