mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-25 23:20:53 +01:00
Added hiding/showing blockquotes
This commit is contained in:
@@ -55,7 +55,7 @@ public class HtmlHelper {
|
||||
return Jsoup.parse(html).body().html();
|
||||
}
|
||||
|
||||
static String sanitize(String html) {
|
||||
static String sanitize(String html, boolean quotes) {
|
||||
Document document = Jsoup.parse(Jsoup.clean(html, Whitelist
|
||||
.relaxed()
|
||||
.addProtocols("img", "src", "cid")
|
||||
@@ -82,6 +82,10 @@ public class HtmlHelper {
|
||||
}
|
||||
}
|
||||
|
||||
if (!quotes)
|
||||
for (Element quote : document.select("blockquote"))
|
||||
quote.text("…");
|
||||
|
||||
NodeTraversor.traverse(new NodeVisitor() {
|
||||
@Override
|
||||
public void head(Node node, int depth) {
|
||||
@@ -242,6 +246,6 @@ public class HtmlHelper {
|
||||
return String.format("<p>%s %s:</p>\n<blockquote>%s</blockquote>",
|
||||
Html.escapeHtml(new Date(message.received).toString()),
|
||||
Html.escapeHtml(MessageHelper.getFormattedAddresses(message.from, true)),
|
||||
sanitize ? sanitize(html) : getBody(html));
|
||||
sanitize ? sanitize(html, true) : getBody(html));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user