From 93ca78abab9dd78cefbbebffd40827b860df260c Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 11 Sep 2019 19:52:04 +0200 Subject: [PATCH] Append br to div with one text node --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 5 +++-- 1 file changed, 3 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 c1ca18f1e5..22644d1e51 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -366,8 +366,9 @@ public class HtmlHelper { // Prevent too many line breaks for (Element div : document.select("div")) { div.tagName("span"); - if (div.parent() != null) - div.after(document.createElement("br")); + if (div.childNodeSize() == 1 && div.childNode(0) instanceof TextNode) + div.appendElement("br"); + div.appendElement("br"); } Element body = document.body();