Is there a `Text` implementation that can take `Sp...
# compose
z
Is there a
Text
implementation that can take
SpannedString
?
z
This returns
AnnotatedString
i couldn't find a way to work with
SpannedString
j
Some of the examples there work with
Spanned
, that
SpannedString
implements. I just thought it could point you in the right direction 🙂
z
Alright, thanks man!
That's amazing! Great work!
m
It’s a pity that this is Android only. What about Compose desktop?
a
@Michael Paus You are invited to make a pull request to remove the dependencies to Android 😉
z
Inside the lib it's basically one composeable, you can look at it and remove all android related stuff.
m
The default OSS answer 😉 (But I am actually just looking at the code.)
a
This is not quite as easy as it seems at first. The core of the library is not to provide the composable function, but the toAnnotatedString function, which turns an android string resource into an annotated string via getText. For this purpose androidx.core is used here.
👌 1
m
Right 😭
a
I'm not as familiar with compose-desktop as I am with compose, so I'm running out of ideas here.
t
You'd use something like JSoup to parse an HTML string to a document fragment and build up an AnnotatedString by traversing the elements.