mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Refactoring
This commit is contained in:
parent
0acc4c796f
commit
ac9ef4456e
2 changed files with 16 additions and 12 deletions
|
@ -3415,8 +3415,6 @@ public class HtmlHelper {
|
||||||
next.remove();
|
next.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.body().tagName("div").wrap("<body></body>");
|
|
||||||
|
|
||||||
return doc.html();
|
return doc.html();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ import com.sun.mail.util.MessageRemovedIOException;
|
||||||
|
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.nodes.Node;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
import org.simplejavamail.outlookmessageparser.OutlookMessageParser;
|
import org.simplejavamail.outlookmessageparser.OutlookMessageParser;
|
||||||
import org.simplejavamail.outlookmessageparser.model.OutlookAttachment;
|
import org.simplejavamail.outlookmessageparser.model.OutlookAttachment;
|
||||||
|
@ -912,16 +913,21 @@ public class MessageHelper {
|
||||||
if (auto_link)
|
if (auto_link)
|
||||||
HtmlHelper.autoLink(document);
|
HtmlHelper.autoLink(document);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(compose_font))
|
if (!TextUtils.isEmpty(compose_font)) {
|
||||||
for (Element child : document.body().children())
|
List<Node> childs = new ArrayList<>();
|
||||||
if (!TextUtils.isEmpty(child.text()) &&
|
for (Node child : document.body().childNodes())
|
||||||
TextUtils.isEmpty(child.attr("fairemail"))) {
|
if (TextUtils.isEmpty(child.attr("fairemail"))) {
|
||||||
String old = child.attr("style");
|
childs.add(child);
|
||||||
String style = HtmlHelper.mergeStyles(
|
child.remove();
|
||||||
"font-family:" + StyleHelper.getFamily(compose_font), old);
|
} else
|
||||||
if (!old.equals(style))
|
break;
|
||||||
child.attr("style", style);
|
|
||||||
}
|
Element div = document.createElement("div").attr("style",
|
||||||
|
"font-family:" + StyleHelper.getFamily(compose_font));
|
||||||
|
for (Node child : childs)
|
||||||
|
div.appendChild(child);
|
||||||
|
document.body().prependChild(div);
|
||||||
|
}
|
||||||
|
|
||||||
document.select("div[fairemail=signature]").removeAttr("fairemail");
|
document.select("div[fairemail=signature]").removeAttr("fairemail");
|
||||||
document.select("div[fairemail=reference]").removeAttr("fairemail");
|
document.select("div[fairemail=reference]").removeAttr("fairemail");
|
||||||
|
|
Loading…
Reference in a new issue