summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-22 17:36:23 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-22 17:36:23 +0100
commit15d7a2f021995bcc2306c6607fc00c96300d1298 (patch)
tree90079a91223095c5a65fd6cc446e190f115d53cb /resources/qml/delegates
parentWarn when no secret can be requested (diff)
downloadnheko-15d7a2f021995bcc2306c6607fc00c96300d1298.tar.xz
Make code tags preserve whitespace
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/TextMessage.qml5
1 files changed, 3 insertions, 2 deletions
diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index bbb58736..156f6ad1 100644
--- a/resources/qml/delegates/TextMessage.qml
+++ b/resources/qml/delegates/TextMessage.qml
@@ -22,7 +22,8 @@ MatrixText {
     text: "
     <style type=\"text/css\">
     a { color:" + Nheko.colors.link + ";}
-    code { background-color: " + Nheko.colors.alternateBase + ";}
+    code { background-color: " + Nheko.colors.alternateBase + "; white-space: pre-wrap; }
+    pre { background-color: " + Nheko.colors.alternateBase + "; white-space: pre-wrap; }
     table {
         border-width: 1px;
         border-collapse: collapse;
@@ -40,7 +41,7 @@ MatrixText {
         background-color: " + Nheko.colors.text + ";
     }" : "") +  // TODO(Nico): Figure out how to support mobile
     "</style>
-    " + formatted.replace(/<pre>/g, "<pre style='white-space: pre-wrap; background-color: " + Nheko.colors.alternateBase + "'>").replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
+    " + formatted.replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
     width: parent.width
     height: !keepFullText ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : implicitHeight
     clip: !keepFullText