mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-15 00:21:10 +00:00
Fixed RTL support
This commit is contained in:
parent
61323e0d2e
commit
6651b741eb
1 changed files with 37 additions and 12 deletions
|
@ -1154,20 +1154,22 @@ public class HtmlHelper {
|
|||
e.attr("x-line-after", "true");
|
||||
}
|
||||
} else {
|
||||
String style = e.attr("style");
|
||||
e.attr("style",
|
||||
mergeStyles(style, "margin-top:0;margin-bottom:0"));
|
||||
if (!BuildConfig.DEBUG) {
|
||||
String style = e.attr("style");
|
||||
e.attr("style",
|
||||
mergeStyles(style, "margin-top:0;margin-bottom:0"));
|
||||
|
||||
int ltr = 0;
|
||||
int rtl = 0;
|
||||
for (Element li : e.children()) {
|
||||
if ("rtl".equals(li.attr("dir")))
|
||||
rtl++;
|
||||
else
|
||||
ltr++;
|
||||
li.removeAttr("dir");
|
||||
int ltr = 0;
|
||||
int rtl = 0;
|
||||
for (Element li : e.children()) {
|
||||
if ("rtl".equals(li.attr("dir")))
|
||||
rtl++;
|
||||
else
|
||||
ltr++;
|
||||
li.removeAttr("dir");
|
||||
}
|
||||
e.attr("dir", rtl > ltr ? "rtl" : "ltr");
|
||||
}
|
||||
e.attr("dir", rtl > ltr ? "rtl" : "ltr");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3262,7 +3264,17 @@ public class HtmlHelper {
|
|||
String html = converter.toHtml(spanned, TO_HTML_PARAGRAPH_LINES_INDIVIDUAL);
|
||||
|
||||
Document doc = JsoupEx.parse(html);
|
||||
|
||||
for (Element span : doc.select("span")) {
|
||||
if (span.attr("dir").equals("rtl")) {
|
||||
Element next = span.nextElementSibling();
|
||||
if (next != null && next.tagName().equals("br")) {
|
||||
span.tagName("div");
|
||||
span.appendElement("br");
|
||||
next.remove();
|
||||
}
|
||||
}
|
||||
|
||||
String style = span.attr("style");
|
||||
if (TextUtils.isEmpty(style))
|
||||
continue;
|
||||
|
@ -3306,6 +3318,19 @@ public class HtmlHelper {
|
|||
}
|
||||
}
|
||||
|
||||
for (Element e : doc.select("ol,ul")) {
|
||||
int ltr = 0;
|
||||
int rtl = 0;
|
||||
for (Element li : e.children()) {
|
||||
if ("rtl".equals(li.attr("dir")))
|
||||
rtl++;
|
||||
else
|
||||
ltr++;
|
||||
li.removeAttr("dir");
|
||||
}
|
||||
e.attr("dir", rtl > ltr ? "rtl" : "ltr");
|
||||
}
|
||||
|
||||
for (Element quote : doc.select("blockquote")) {
|
||||
Element prev = quote.previousElementSibling();
|
||||
if (prev != null && "br".equals(prev.tagName()))
|
||||
|
|
Loading…
Add table
Reference in a new issue