Added computed HTML styles

pull/206/head
M66B 3 years ago
parent 57969cda1b
commit 3df658e6eb

@ -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…
Cancel
Save