mirror of https://github.com/M66B/FairEmail.git
Skip aligning table content
This commit is contained in:
parent
4117f533ea
commit
eed8d3fb34
|
@ -519,12 +519,14 @@ public class HtmlHelper {
|
||||||
if ("center".equals(element.tagName())) {
|
if ("center".equals(element.tagName())) {
|
||||||
style = mergeStyles(style, "text-align:center");
|
style = mergeStyles(style, "text-align:center");
|
||||||
element.tagName("div");
|
element.tagName("div");
|
||||||
|
} else if ("table".equals(element.tagName()))
|
||||||
|
style = mergeStyles(style, "text-align:left");
|
||||||
|
else {
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||||
|
String align = element.attr("align");
|
||||||
|
if (!TextUtils.isEmpty(align))
|
||||||
|
style = mergeStyles(style, "text-align:" + align);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
|
||||||
String align = element.attr("align");
|
|
||||||
if (!TextUtils.isEmpty(align))
|
|
||||||
style = mergeStyles(style, "text-align:" + align);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process style
|
// Process style
|
||||||
|
@ -1910,25 +1912,33 @@ public class HtmlHelper {
|
||||||
ssb.setSpan(new StrikethroughSpan(), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
ssb.setSpan(new StrikethroughSpan(), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
break;
|
break;
|
||||||
case "text-align":
|
case "text-align":
|
||||||
for (AlignmentSpan span : ssb.getSpans(0, start, AlignmentSpan.class)) {
|
boolean table = false;
|
||||||
int s = ssb.getSpanStart(span);
|
Element e = element;
|
||||||
ssb.removeSpan(span);
|
while (e != null) {
|
||||||
ssb.setSpan(span, s, start, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
if ("table".equals(e.tagName())) {
|
||||||
|
table = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
e = e.parent();
|
||||||
}
|
}
|
||||||
Layout.Alignment alignment = null;
|
|
||||||
switch (value) {
|
if (!table) {
|
||||||
case "left":
|
Layout.Alignment alignment = null;
|
||||||
alignment = (ltr ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE);
|
switch (value) {
|
||||||
break;
|
case "left":
|
||||||
case "center":
|
case "justify":
|
||||||
alignment = Layout.Alignment.ALIGN_CENTER;
|
alignment = (ltr ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_OPPOSITE);
|
||||||
break;
|
break;
|
||||||
case "right":
|
case "center":
|
||||||
alignment = (ltr ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL);
|
alignment = Layout.Alignment.ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
|
case "right":
|
||||||
|
alignment = (ltr ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (alignment != null)
|
||||||
|
ssb.setSpan(new AlignmentSpan.Standard(alignment), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
if (alignment != null)
|
|
||||||
ssb.setSpan(new AlignmentSpan.Standard(alignment), start, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue