Prevent extra padding

pull/178/head
M66B 5 years ago
parent e0c839e9a9
commit 0110fb4ec9

@ -620,11 +620,9 @@ 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 && p[0] > 0.5)
element.parents().select("*[line-before]").size() == 0)
element.attr("line-before", "true"); element.attr("line-before", "true");
if (p[2] != null && p[2] > 0.5 && if (p[2] != null && p[2] > 0.5)
element.parents().select("*[line-after]").size() == 0)
element.attr("line-after", "true"); element.attr("line-after", "true");
} }
break; break;
@ -910,10 +908,17 @@ public class HtmlHelper {
div.tagName("span"); div.tagName("span");
for (Element e : document.select("*[line-before],*[line-after]")) { for (Element e : document.select("*[line-before],*[line-after]")) {
if (!"".equals(e.attr("line-before"))) if (!TextUtils.isEmpty(e.attr("line-before"))) {
e.prependElement("br"); Element prev = e.previousElementSibling();
if (!"".equals(e.attr("line-after"))) if (prev == null || !"br".equals(prev.tagName()))
e.appendElement("br"); e.prependElement("br");
}
if (!TextUtils.isEmpty(e.attr("line-after"))) {
Element next = e.nextElementSibling();
if (next == null || !"br".equals(next.tagName()))
e.appendElement("br");
}
} }
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)

Loading…
Cancel
Save