mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improvements for #1846
This commit is contained in:
parent
8b5547104d
commit
66553a36da
2 changed files with 21 additions and 3 deletions
|
|
@ -257,6 +257,15 @@ export const
|
||||||
rightmargin: (value, node) => node.style.marginRight = pInt(value) + 'px'
|
rightmargin: (value, node) => node.style.marginRight = pInt(value) + 'px'
|
||||||
},
|
},
|
||||||
allowedAttributes = [
|
allowedAttributes = [
|
||||||
|
// SnappyMail
|
||||||
|
// 'data-x-href-broken',
|
||||||
|
// 'data-x-href-tracking',
|
||||||
|
'data-x-src',
|
||||||
|
// 'data-x-src-hidden',
|
||||||
|
// 'data-x-src-tracking',
|
||||||
|
// 'data-x-src-broken',
|
||||||
|
// 'data-x-style-url',
|
||||||
|
// 'data-x-style-broken-urls',
|
||||||
// defaults
|
// defaults
|
||||||
'name',
|
'name',
|
||||||
'dir', 'lang', 'style', 'title',
|
'dir', 'lang', 'style', 'title',
|
||||||
|
|
@ -493,12 +502,12 @@ export const
|
||||||
let attachment;
|
let attachment;
|
||||||
if (value.startsWith('cid:'))
|
if (value.startsWith('cid:'))
|
||||||
{
|
{
|
||||||
|
setAttribute('data-x-src', value);
|
||||||
value = value.slice(4);
|
value = value.slice(4);
|
||||||
setAttribute('data-x-src-cid', value);
|
|
||||||
attachment = findAttachmentByCid(value);
|
attachment = findAttachmentByCid(value);
|
||||||
if (attachment?.download) {
|
if (attachment?.download) {
|
||||||
oElement.src = attachment.linkPreview();
|
oElement.src = attachment.linkPreview();
|
||||||
oElement.title += ' ('+attachment.fileName+')';
|
// oElement.title || (oElement.title = '+attachment.fileName);
|
||||||
attachment.isInline(true);
|
attachment.isInline(true);
|
||||||
attachment.isLinked(true);
|
attachment.isLinked(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -970,7 +970,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
// https://github.com/the-djmaze/snappymail/issues/491
|
// https://github.com/the-djmaze/snappymail/issues/491
|
||||||
tpl.innerHTML = oLastMessage.bodyAsHTML();
|
tpl.innerHTML = oLastMessage.bodyAsHTML();
|
||||||
tpl.content.querySelectorAll('img').forEach(img => {
|
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();
|
sText = tpl.innerHTML.trim();
|
||||||
|
|
||||||
|
|
@ -1514,6 +1514,15 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
isHtml = this.oEditor.isHtml();
|
isHtml = this.oEditor.isHtml();
|
||||||
|
|
||||||
if (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 {
|
do {
|
||||||
l = Text.length;
|
l = Text.length;
|
||||||
Text = Text
|
Text = Text
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue