From f1606ebb37d2f5407aa2622ff546befa6e1adcda Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 16 Nov 2019 19:27:40 +0100 Subject: [PATCH] Use selected font for plain text messages --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 5 ++++- app/src/main/java/eu/faircode/email/MessageHelper.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index a086c9e08d..56cb34ceef 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -135,6 +135,7 @@ public class HtmlHelper { Whitelist whitelist = Whitelist.relaxed() .addTags("hr", "abbr", "big", "font") + .addAttributes("pre", "plain") .removeTags("col", "colgroup", "thead", "tbody") .removeAttributes("table", "width") .removeAttributes("td", "colspan", "rowspan", "width") @@ -327,7 +328,9 @@ public class HtmlHelper { for (int i = 0; i < level; i++) sb.append(""); - pre.tagName("tt"); // monospace + String plain = pre.attr("plain"); + pre.tagName(Boolean.parseBoolean(plain) ? "div" : "tt"); + pre.html(sb.toString()); } diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 259ed2e3bc..81cda3f8a6 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -1042,7 +1042,7 @@ public class MessageHelper { } if (part == plain) - result = "
" + result + "
"; + result = "
" + result + "
"; return result; }