mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved cleanHtml() handling of table width and content
This commit is contained in:
parent
121f6f0bf8
commit
eb98c0713a
1 changed files with 10 additions and 7 deletions
|
|
@ -94,8 +94,8 @@ export const
|
||||||
'INPUT','OUTPUT','SELECT','BUTTON','TEXTAREA',
|
'INPUT','OUTPUT','SELECT','BUTTON','TEXTAREA',
|
||||||
'BGSOUND','KEYGEN','SOURCE','OBJECT','EMBED','APPLET','IFRAME','FRAME','FRAMESET','VIDEO','AUDIO','AREA','MAP'
|
'BGSOUND','KEYGEN','SOURCE','OBJECT','EMBED','APPLET','IFRAME','FRAME','FRAMESET','VIDEO','AUDIO','AREA','MAP'
|
||||||
],
|
],
|
||||||
inlineTags = [
|
nonEmptyTags = [
|
||||||
'A','B','EM','I','SPAN','STRONG','O:P'
|
'A','B','EM','I','SPAN','STRONG','O:P','TABLE'
|
||||||
];
|
];
|
||||||
|
|
||||||
tpl.innerHTML = html
|
tpl.innerHTML = html
|
||||||
|
|
@ -131,7 +131,7 @@ export const
|
||||||
// || (oStyle.maxHeight && 1 > parseFloat(oStyle.maxHeight)
|
// || (oStyle.maxHeight && 1 > parseFloat(oStyle.maxHeight)
|
||||||
// || (oStyle.maxWidth && 1 > parseFloat(oStyle.maxWidth)
|
// || (oStyle.maxWidth && 1 > parseFloat(oStyle.maxWidth)
|
||||||
// || ('0' === oStyle.opacity
|
// || ('0' === oStyle.opacity
|
||||||
|| (inlineTags.includes(name) && '' == oElement.textContent.trim())
|
|| (nonEmptyTags.includes(name) && ('' == oElement.textContent.trim() && !oElement.querySelector('img')))
|
||||||
) {
|
) {
|
||||||
oElement.remove();
|
oElement.remove();
|
||||||
return;
|
return;
|
||||||
|
|
@ -173,11 +173,14 @@ export const
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ('TABLE' === name && hasAttribute('width')) {
|
else if ('TABLE' === name) {
|
||||||
value = getAttribute('width');
|
if (hasAttribute('width')) {
|
||||||
if (!value.includes('%')) {
|
oStyle.width = getAttribute('width');
|
||||||
delAttribute('width');
|
delAttribute('width');
|
||||||
oStyle.maxWidth = value + 'px';
|
}
|
||||||
|
value = oStyle.width;
|
||||||
|
if (value && !value.includes('%')) {
|
||||||
|
oStyle.maxWidth = value;
|
||||||
oStyle.width = '100%';
|
oStyle.width = '100%';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue