How can I display user-provider text with links? J...
# compose-desktop
m
How can I display user-provider text with links? Just like here: https://google.com/ I need to: • Have the links be detected in text • Apply styling to them • Have the pointer change on hover • Detect clicks so I can open the browser • Have the text still be selectable (
SelectionContainer
) This seems like a basic feature but I can't find anything.
m
We have done all of that apart from allowing the text to be selectable - mostly relies on ClickableText and span styles: https://github.com/UstadMobile/UstadMobile/blob/primary/lib-ui-compose/src/commonM[…]lin/com/ustadmobile/libuicompose/components/UstadLinkifyText.kt
The LocalUriHandler provider is what is defacto used to handle clicks on links. You can provide something that then calls Desktop.getDesktop().browse()
m
Thanks, I'll try doing the same. I can always provide my own right click menu with "Copy all" option. Not perfect but should be good enough.
👍 1
z
post your updates here please. i am also interested in that
s
If you manage to make them selectable and clickable, please let me know. This bug still seems to be present in 1.5.12: https://issuetracker.google.com/issues/184950231
z
Link support is being actively worked on! • r.android.com/2905950r.android.com/2839017r.android.com/2914706r.android.com/2943866
🦜 1
m
I ended up using a similar approach to what Mike linked, with ClickableText. The ability to copy text is provided with a right-click context menu, since ClickableText doesn't work with selection.