forked from github/szkolny
[Messages] Fix HTML line break decoding and encoding.
This commit is contained in:
parent
49a093201b
commit
27413a9745
@ -47,7 +47,11 @@ object BetterHtml {
|
|||||||
var text = html
|
var text = html
|
||||||
.replace("\\[META:[A-z0-9]+;[0-9-]+]".toRegex(), "")
|
.replace("\\[META:[A-z0-9]+;[0-9-]+]".toRegex(), "")
|
||||||
.replace("background-color: ?$hexPattern;".toRegex(), "")
|
.replace("background-color: ?$hexPattern;".toRegex(), "")
|
||||||
|
// treat paragraphs as if they had no margin
|
||||||
|
.replace("<p", "<span")
|
||||||
|
.replace("</p>", "</span><br>")
|
||||||
|
|
||||||
|
// this is used only in Notes and Events
|
||||||
if (nl2br) {
|
if (nl2br) {
|
||||||
text = text.replace("\n", "<br>")
|
text = text.replace("\n", "<br>")
|
||||||
}
|
}
|
||||||
|
@ -200,13 +200,16 @@ class TextStylingManager(private val app: App) {
|
|||||||
|
|
||||||
if (htmlMode == COMPATIBLE) {
|
if (htmlMode == COMPATIBLE) {
|
||||||
textHtml = textHtml
|
textHtml = textHtml
|
||||||
.replace("<br>", "<p> </p>")
|
.substringBeforeLast("</p>")
|
||||||
|
.replace("<p>", "")
|
||||||
|
.replace("</p>", "<br>")
|
||||||
.replace("<b>", "<strong>")
|
.replace("<b>", "<strong>")
|
||||||
.replace("</b>", "</strong>")
|
.replace("</b>", "</strong>")
|
||||||
.replace("<i>", "<em>")
|
.replace("<i>", "<em>")
|
||||||
.replace("</i>", "</em>")
|
.replace("</i>", "</em>")
|
||||||
.replace("<u>", "<span style=\"text-decoration: underline;\">")
|
.replace("<u>", "<span style=\"text-decoration: underline;\">")
|
||||||
.replace("</u>", "</span>")
|
.replace("</u>", "</span>")
|
||||||
|
textHtml = "<p>$textHtml</p>"
|
||||||
}
|
}
|
||||||
|
|
||||||
return textHtml
|
return textHtml
|
||||||
|
Loading…
Reference in New Issue
Block a user