mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 22:21:18 +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()
|
||||
.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…
Reference in a new issue