mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Added computed HTML styles
This commit is contained in:
parent
57969cda1b
commit
3df658e6eb
1 changed files with 13 additions and 0 deletions
|
@ -154,6 +154,7 @@ import com.google.android.material.snackbar.Snackbar;
|
|||
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.w3c.dom.css.CSSStyleSheet;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -5449,6 +5450,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
File file = EntityMessage.getFile(context, id);
|
||||
Document d = JsoupEx.parse(file);
|
||||
|
||||
List<CSSStyleSheet> sheets =
|
||||
HtmlHelper.parseStyles(d.head().select("style"));
|
||||
for (Element element : d.select("*")) {
|
||||
String computed = HtmlHelper.processStyles(
|
||||
element.tagName(),
|
||||
element.className(),
|
||||
element.attr("style"),
|
||||
sheets);
|
||||
if (!TextUtils.isEmpty(computed))
|
||||
element.attr("computed", computed);
|
||||
}
|
||||
|
||||
return d.html();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue