From f5cb2cab05fb948d44fe9d274fcbf5fe06066257 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 24 Feb 2023 16:19:33 +0100 Subject: [PATCH] Guarantee line break for empty paragraphs --- .../main/java/eu/faircode/email/HtmlHelper.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index cf7b043642..a4a775d446 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -1115,19 +1115,11 @@ public class HtmlHelper { // Paragraphs for (Element p : document.select("p")) { p.tagName("div"); - if (p.childNodeSize() != 0) { - if (p.childNodeSize() == 1) { - Node lonely = p.childNode(0); - if (lonely instanceof TextNode && - "\u00a0".equals(((TextNode) lonely).getWholeText())) - continue; - } + if (TextUtils.isEmpty(p.text())) { + p.attr("x-line-before", "false"); + p.attr("x-line-after", "true"); + } else p.attr("x-paragraph", "true"); - if (TextUtils.isEmpty(p.text())) { - p.removeAttr("x-line-before"); - p.removeAttr("x-line-after"); - } - } } // Short inline quotes