1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Link images to anchors without hyperlink

This commit is contained in:
M66B 2019-02-17 20:31:30 +00:00
parent 8028304485
commit 692b1e5ce2

View file

@ -83,15 +83,18 @@ public class HtmlHelper {
for (Element img : document.select("img")) {
img.prependElement("br");
boolean linked = false;
for (Element parent : img.parents())
if ("a".equals(parent.tagName())) {
linked = true;
break;
}
if (!linked) {
String src = img.attr("src");
if (src.startsWith("http://") || src.startsWith("https://")) {
String src = img.attr("src");
if (src.startsWith("http://") || src.startsWith("https://")) {
boolean linked = false;
for (Element parent : img.parents())
if ("a".equals(parent.tagName())) {
if (TextUtils.isEmpty(parent.attr("href")))
parent.attr("href", img.attr("src"));
linked = true;
break;
}
if (!linked) {
Element a = document.createElement("a");
a.attr("href", src);
a.appendChild(img.clone());