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
803 stars 67 forks source link

Fix: LinkClickHandler does not work when clicking a link in the markdown list #143

Open mbkim95 opened 5 months ago

mbkim95 commented 5 months ago

There is an issue with the LinkClickHandler not working properly when a link is placed inside a markdown list, as in the example above.

I found that the process of parsing the markdown syntax and converting it to ASTs works recursively. In this case, if the type of AST node is AstUnorderedList or AstOrderedList, it calls the FormattedList() Composable function, which calls the BasicRichText function inside the FormattedList() Composable function. However, the linkClickHandler parameter of the BasicRichText()Composable function is not used, so the LinkClickHandler registered by the user is not working properly. Rather, the LinkClickHandler is becoming null.

Inside the FormattedList() Composable function, I also modified the LocalLinkClickHandler to accept a user-registered LinkClickHandler and pass it to the BasicRichText() Composable function.

Please review the modified code.

Thank you