mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-22 22:04:43 +08: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',
|
||||
'BGSOUND','KEYGEN','SOURCE','OBJECT','EMBED','APPLET','IFRAME','FRAME','FRAMESET','VIDEO','AUDIO','AREA','MAP'
|
||||
],
|
||||
inlineTags = [
|
||||
'A','B','EM','I','SPAN','STRONG','O:P'
|
||||
nonEmptyTags = [
|
||||
'A','B','EM','I','SPAN','STRONG','O:P','TABLE'
|
||||
];
|
||||
|
||||
tpl.innerHTML = html
|
||||
|
@ -131,7 +131,7 @@ export const
|
|||
// || (oStyle.maxHeight && 1 > parseFloat(oStyle.maxHeight)
|
||||
// || (oStyle.maxWidth && 1 > parseFloat(oStyle.maxWidth)
|
||||
// || ('0' === oStyle.opacity
|
||||
|| (inlineTags.includes(name) && '' == oElement.textContent.trim())
|
||||
|| (nonEmptyTags.includes(name) && ('' == oElement.textContent.trim() && !oElement.querySelector('img')))
|
||||
) {
|
||||
oElement.remove();
|
||||
return;
|
||||
|
@ -173,11 +173,14 @@ export const
|
|||
});
|
||||
}
|
||||
|
||||
else if ('TABLE' === name && hasAttribute('width')) {
|
||||
value = getAttribute('width');
|
||||
if (!value.includes('%')) {
|
||||
else if ('TABLE' === name) {
|
||||
if (hasAttribute('width')) {
|
||||
oStyle.width = getAttribute('width');
|
||||
delAttribute('width');
|
||||
oStyle.maxWidth = value + 'px';
|
||||
}
|
||||
value = oStyle.width;
|
||||
if (value && !value.includes('%')) {
|
||||
oStyle.maxWidth = value;
|
||||
oStyle.width = '100%';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue