From e8e92b7296cef37628365012da7db2c7fbd2d60d Mon Sep 17 00:00:00 2001 From: Tlaster Date: Thu, 12 Dec 2024 13:36:36 +0900 Subject: [PATCH 1/2] fix misskey linebreak --- .../kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt b/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt index 3c054b58f..b201c3a97 100644 --- a/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt +++ b/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt @@ -801,7 +801,12 @@ private fun moe.tlaster.mfm.parser.tree.Node.toHtml(accountKey: MicroBlogKey): E is moe.tlaster.mfm.parser.tree.TextNode -> { Element("span").apply { - appendChild(TextNode(content)) + content.split("\n").forEachIndexed { index, line -> + if (index != 0) { + appendChild(Element("br")) + } + appendChild(TextNode(line)) + } } } From 768684fcbe2981f6ef41f2b6f63be85215dabe1e Mon Sep 17 00:00:00 2001 From: Tlaster Date: Thu, 12 Dec 2024 17:42:31 +0900 Subject: [PATCH 2/2] fix misskey richtext --- .../kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt b/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt index b201c3a97..71db3f63c 100644 --- a/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt +++ b/shared/src/commonMain/kotlin/dev/dimension/flare/ui/model/mapper/Misskey.kt @@ -764,7 +764,9 @@ private fun moe.tlaster.mfm.parser.tree.Node.toHtml(accountKey: MicroBlogKey): E Element("a").apply { // attributes["href"] = url attributes().put("href", url) - appendChild(TextNode(content)) + content.forEach { + appendChild(it.toHtml(accountKey)) + } } }