mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 06:31:17 +00:00
Process HTML font
This commit is contained in:
parent
1d1b9f084a
commit
8e245517f3
1 changed files with 12 additions and 2 deletions
|
@ -136,7 +136,7 @@ public class HtmlHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
Whitelist whitelist = Whitelist.relaxed()
|
Whitelist whitelist = Whitelist.relaxed()
|
||||||
.addTags("hr", "abbr", "big")
|
.addTags("hr", "abbr", "big", "font")
|
||||||
.removeTags("col", "colgroup", "thead", "tbody")
|
.removeTags("col", "colgroup", "thead", "tbody")
|
||||||
.removeAttributes("table", "width")
|
.removeAttributes("table", "width")
|
||||||
.removeAttributes("td", "colspan", "rowspan", "width")
|
.removeAttributes("td", "colspan", "rowspan", "width")
|
||||||
|
@ -144,12 +144,22 @@ public class HtmlHelper {
|
||||||
.addProtocols("img", "src", "cid")
|
.addProtocols("img", "src", "cid")
|
||||||
.addProtocols("img", "src", "data");
|
.addProtocols("img", "src", "data");
|
||||||
if (text_color)
|
if (text_color)
|
||||||
whitelist.addAttributes(":all", "style");
|
whitelist
|
||||||
|
.addAttributes(":all", "style")
|
||||||
|
.addAttributes("font", "color");
|
||||||
|
|
||||||
final Document document = new Cleaner(whitelist).clean(parsed);
|
final Document document = new Cleaner(whitelist).clean(parsed);
|
||||||
|
|
||||||
boolean dark = Helper.isDarkTheme(context);
|
boolean dark = Helper.isDarkTheme(context);
|
||||||
|
|
||||||
|
// Font
|
||||||
|
for (Element font : document.select("font")) {
|
||||||
|
String color = font.attr("color");
|
||||||
|
font.removeAttr("color");
|
||||||
|
font.attr("style", "color:" + color + ";");
|
||||||
|
font.tagName("span");
|
||||||
|
}
|
||||||
|
|
||||||
// Sanitize span styles
|
// Sanitize span styles
|
||||||
for (Element span : document.select("*")) {
|
for (Element span : document.select("*")) {
|
||||||
String style = span.attr("style");
|
String style = span.attr("style");
|
||||||
|
|
Loading…
Reference in a new issue