mirror of https://github.com/M66B/FairEmail.git
Added support for background images
This commit is contained in:
parent
864b014f3c
commit
88bc43f836
|
@ -653,6 +653,22 @@ public class HtmlHelper {
|
|||
for (String key : keys) {
|
||||
String value = kv.get(key);
|
||||
switch (key) {
|
||||
case "background-image":
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/background-image
|
||||
String url = value.replace(" ", "");
|
||||
int us = url.indexOf("url(");
|
||||
int ue = url.indexOf(')', us + 4);
|
||||
if (us >= 0 && ue > us) {
|
||||
url = url.substring(us + 4, ue);
|
||||
if ((url.startsWith("'") && url.endsWith("'")) ||
|
||||
(url.startsWith("\"") && url.endsWith("\"")))
|
||||
url = url.substring(1, url.length() - 1);
|
||||
Element img = document.createElement("img")
|
||||
.attr("src", url);
|
||||
element.prependElement("br");
|
||||
element.prependChild(img);
|
||||
}
|
||||
break;
|
||||
case "color":
|
||||
case "background":
|
||||
case "background-color":
|
||||
|
|
Loading…
Reference in New Issue