Fixed RTL align

This commit is contained in:
M66B 2021-04-23 20:25:15 +02:00
parent a9f12de3da
commit 73f85586db
1 changed files with 9 additions and 1 deletions

View File

@ -424,6 +424,7 @@ public class HtmlHelper {
.addTags("hr", "abbr", "big", "font", "dfn", "del", "s", "tt") .addTags("hr", "abbr", "big", "font", "dfn", "del", "s", "tt")
.addAttributes(":all", "class") .addAttributes(":all", "class")
.addAttributes(":all", "style") .addAttributes(":all", "style")
.addAttributes("span", "dir")
.addAttributes("div", "x-plain") .addAttributes("div", "x-plain")
.removeTags("col", "colgroup") .removeTags("col", "colgroup")
.removeTags("thead", "tbody", "tfoot") .removeTags("thead", "tbody", "tfoot")
@ -547,7 +548,11 @@ public class HtmlHelper {
// Process style // Process style
if (!TextUtils.isEmpty(style)) { if (!TextUtils.isEmpty(style)) {
boolean block = false;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if ("span".equals(element.tagName()) &&
"rtl".equals(element.attr("dir")))
block = true;
Map<String, String> kv = new LinkedHashMap<>(); Map<String, String> kv = new LinkedHashMap<>();
String[] params = style.split(";"); String[] params = style.split(";");
@ -736,14 +741,17 @@ public class HtmlHelper {
case "text-align": case "text-align":
// https://developer.mozilla.org/en-US/docs/Web/CSS/text-align // https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
if (text_align) { if (text_align) {
block = true;
element.attr("x-align", value); element.attr("x-align", value);
sb.append("display:block;");
sb.append(key).append(':').append(value).append(';'); sb.append(key).append(':').append(value).append(';');
} }
break; break;
} }
} }
if (block)
sb.append("display:block;");
if (sb.length() == 0) if (sb.length() == 0)
element.removeAttr("style"); element.removeAttr("style");
else { else {