Skip to content

Commit 9aed8cb

Browse files
authored
Merge pull request #596 from DimensionDev/bugfix/misskey_text
fix misskey text rendering
2 parents ee99b96 + 768684f commit 9aed8cb

File tree

1 file changed

+9
-2
lines changed
  • shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper

1 file changed

+9
-2
lines changed

shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,9 @@ private fun moe.tlaster.mfm.parser.tree.Node.toHtml(accountKey: MicroBlogKey): E
764764
Element("a").apply {
765765
// attributes["href"] = url
766766
attributes().put("href", url)
767-
appendChild(TextNode(content))
767+
content.forEach {
768+
appendChild(it.toHtml(accountKey))
769+
}
768770
}
769771
}
770772

@@ -801,7 +803,12 @@ private fun moe.tlaster.mfm.parser.tree.Node.toHtml(accountKey: MicroBlogKey): E
801803

802804
is moe.tlaster.mfm.parser.tree.TextNode -> {
803805
Element("span").apply {
804-
appendChild(TextNode(content))
806+
content.split("\n").forEachIndexed { index, line ->
807+
if (index != 0) {
808+
appendChild(Element("br"))
809+
}
810+
appendChild(TextNode(line))
811+
}
805812
}
806813
}
807814

0 commit comments

Comments
 (0)