Process HTML font

pull/162/head
M66B 5 years ago
parent 1d1b9f084a
commit 8e245517f3

@ -136,7 +136,7 @@ public class HtmlHelper {
}
Whitelist whitelist = Whitelist.relaxed()
.addTags("hr", "abbr", "big")
.addTags("hr", "abbr", "big", "font")
.removeTags("col", "colgroup", "thead", "tbody")
.removeAttributes("table", "width")
.removeAttributes("td", "colspan", "rowspan", "width")
@ -144,12 +144,22 @@ public class HtmlHelper {
.addProtocols("img", "src", "cid")
.addProtocols("img", "src", "data");
if (text_color)
whitelist.addAttributes(":all", "style");
whitelist
.addAttributes(":all", "style")
.addAttributes("font", "color");
final Document document = new Cleaner(whitelist).clean(parsed);
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
for (Element span : document.select("*")) {
String style = span.attr("style");

Loading…
Cancel
Save