mirror of https://github.com/M66B/FairEmail.git
Suppress extra p new line when margin/padding is zero
This commit is contained in:
parent
5bb5e9802d
commit
2d951d3b7a
|
@ -659,10 +659,16 @@ public class HtmlHelper {
|
||||||
else if (key.endsWith("bottom"))
|
else if (key.endsWith("bottom"))
|
||||||
p[0] = null;
|
p[0] = null;
|
||||||
|
|
||||||
if (p[0] != null && p[0] > 0.5)
|
if (p[0] != null)
|
||||||
element.attr("x-line-before", "true");
|
if (p[0] == 0)
|
||||||
if (p[2] != null && p[2] > 0.5)
|
element.attr("x-line-before", "false");
|
||||||
element.attr("x-line-after", "true");
|
else if (p[0] > 0.5)
|
||||||
|
element.attr("x-line-before", "true");
|
||||||
|
if (p[2] != null)
|
||||||
|
if (p[2] == 0)
|
||||||
|
element.attr("x-line-after", "false");
|
||||||
|
else if (p[2] > 0.5)
|
||||||
|
element.attr("x-line-after", "true");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -704,7 +710,8 @@ public class HtmlHelper {
|
||||||
|
|
||||||
// Paragraphs
|
// Paragraphs
|
||||||
for (Element p : document.select("p")) {
|
for (Element p : document.select("p")) {
|
||||||
p.appendElement("br");
|
if (!"false".equals(p.attr("x-line-after")))
|
||||||
|
p.appendElement("br");
|
||||||
p.tagName("div");
|
p.tagName("div");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,13 +965,13 @@ public class HtmlHelper {
|
||||||
div.tagName("span");
|
div.tagName("span");
|
||||||
|
|
||||||
for (Element e : document.select("*[x-line-before],*[x-line-after]")) {
|
for (Element e : document.select("*[x-line-before],*[x-line-after]")) {
|
||||||
if (!TextUtils.isEmpty(e.attr("x-line-before"))) {
|
if ("true".equals(e.attr("x-line-before"))) {
|
||||||
Element prev = e.previousElementSibling();
|
Element prev = e.previousElementSibling();
|
||||||
if (prev == null || !"br".equals(prev.tagName()))
|
if (prev == null || !"br".equals(prev.tagName()))
|
||||||
e.prependElement("br");
|
e.prependElement("br");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(e.attr("x-line-after"))) {
|
if ("true".equals(e.attr("x-line-after"))) {
|
||||||
Element next = e.nextElementSibling();
|
Element next = e.nextElementSibling();
|
||||||
if (next == null || !"br".equals(next.tagName()))
|
if (next == null || !"br".equals(next.tagName()))
|
||||||
e.appendElement("br");
|
e.appendElement("br");
|
||||||
|
|
Loading…
Reference in New Issue