-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clickable hyperlinks #4
Comments
Good point. I was also thinking to add a copy button to each message, but while this makes opening URLs easier too, I guess clicking them directly is even better and probably we should have both eventually. |
I had the idea of enabling markdown rendering of chat messages in general and maybe getting link rendering and clickability for free. Here's the branch: https://github.com/sebkur/lanchat/tree/markdown And this is a screenshot of it in use: bold, italic, code blocks etc. work nice, which is cool. links in What also doesn't work is actually clicking the links (at least on desktop, haven't tried Android yet). |
Hmm, seems to have to do with the SelectionContainer actually. When I run this here with the selection container, clicking the links does not work, whereas when I remove the SelectionContainer clicking does work: package de.mobanisto.lanchat
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.singleWindowApplication
import com.halilibo.richtext.markdown.Markdown
import com.halilibo.richtext.ui.RichText
fun main() {
singleWindowApplication {
LazyColumn {
item {
Text("Foo")
}
item {
SelectionContainer {
RichText(modifier = Modifier.padding(vertical = 8.dp).fillMaxWidth()) {
Markdown("[Google](https://www.google.com)", onLinkClicked = { link ->
println(link)
})
}
}
}
}
}
} |
Looks like this is a problem on desktop only and the root cause is that the SelectionContainer doesn't work with clickable components: JetBrains/compose-multiplatform#1450 |
It would be nice to be able to click on URLs, instead of having to copy and paste them manually in the browser.
The text was updated successfully, but these errors were encountered: