Improvements for #1846

This commit is contained in:
the-djmaze 2024-11-18 16:00:03 +01:00
parent 8b5547104d
commit 66553a36da
2 changed files with 21 additions and 3 deletions

View file

@ -970,7 +970,7 @@ export class ComposePopupView extends AbstractViewPopup {
// https://github.com/the-djmaze/snappymail/issues/491
tpl.innerHTML = oLastMessage.bodyAsHTML();
tpl.content.querySelectorAll('img').forEach(img => {
img.src || img.dataset.xSrcCid || img.dataset.xSrc || img.replaceWith(img.alt || img.title)
img.src || img.dataset.xSrc || img.replaceWith(img.alt || img.title)
});
sText = tpl.innerHTML.trim();
@ -1514,6 +1514,15 @@ export class ComposePopupView extends AbstractViewPopup {
isHtml = this.oEditor.isHtml();
if (isHtml) {
tpl.innerHTML = Text;
tpl.content.querySelectorAll('img').forEach(img => {
if (img.dataset.xSrc) {
img.src = img.dataset.xSrc;
img.removeAttribute('data-x-src')
}
});
Text = tpl.innerHTML.trim();
do {
l = Text.length;
Text = Text