mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-24 14:57:26 +08:00
Resolve #187 (found the real problem, comments in comments)
This commit is contained in:
parent
973cb83ba0
commit
af959e3631
1 changed files with 7 additions and 7 deletions
|
@ -116,8 +116,6 @@ export const
|
|||
.replace(/(<pre[^>]*>)([\s\S]*?)(<\/pre>)/gi, aMatches => {
|
||||
return (aMatches[1] + aMatches[2].trim() + aMatches[3].trim()).replace(/\r?\n/g, '<br>');
|
||||
})
|
||||
// \MailSo\Base\HtmlUtils::ClearComments()
|
||||
.replace(/<!--[\s\S]*?-->/g, '')
|
||||
// GetDomFromText
|
||||
.replace('<o:p></o:p>', '')
|
||||
.replace('<o:p>', '<span>')
|
||||
|
@ -128,6 +126,13 @@ export const
|
|||
.trim();
|
||||
html = '';
|
||||
|
||||
// \MailSo\Base\HtmlUtils::ClearComments()
|
||||
// https://github.com/the-djmaze/snappymail/issues/187
|
||||
const nodeIterator = document.createNodeIterator(tpl.content, NodeFilter.SHOW_COMMENT);
|
||||
while (nodeIterator.nextNode()) {
|
||||
nodeIterator.referenceNode.remove();
|
||||
}
|
||||
|
||||
tpl.content.querySelectorAll('*').forEach(oElement => {
|
||||
const name = oElement.tagName,
|
||||
oStyle = oElement.style,
|
||||
|
@ -172,11 +177,6 @@ export const
|
|||
|
||||
else if ('A' === name) {
|
||||
value = oElement.href;
|
||||
// https://github.com/the-djmaze/snappymail/issues/187 <a> can't have block element inside
|
||||
if (!value || oElement.querySelector('td,div,p,li')) {
|
||||
replaceWithChildren(oElement);
|
||||
return;
|
||||
}
|
||||
value = stripTracking(value);
|
||||
if (!/^([a-z]+):/i.test(value) && '//' !== value.slice(0, 2)) {
|
||||
setAttribute('data-x-broken-href', value);
|
||||
|
|
Loading…
Reference in a new issue