mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-28 11:24:11 +08:00
Don’t remove top level <br> tags that separate text nodes (Apple calendar alerts)
This commit is contained in:
parent
4c6ab52e5a
commit
df26391c57
1 changed files with 6 additions and 5 deletions
|
@ -105,12 +105,13 @@ class QuotedHTMLTransformer {
|
|||
return;
|
||||
}
|
||||
|
||||
// Find back-to-back <br><br> at the top level and de-duplicate them
|
||||
const { children } = doc.body;
|
||||
// Find back-to-back <br><br> at the top level and de-duplicate them. Note that
|
||||
// some emails contain TEXT<br>TEXT<br>TEXT, so the only ELEMENT children may be the <brs>
|
||||
const nodes = doc.body.childNodes;
|
||||
const extraTailBrTags = [];
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
const curr = children[i];
|
||||
const next = children[i - 1];
|
||||
for (let i = nodes.length - 1; i >= 0; i--) {
|
||||
const curr = nodes[i];
|
||||
const next = nodes[i - 1];
|
||||
if (curr && curr.nodeName === 'BR' && next && next.nodeName === 'BR') {
|
||||
extraTailBrTags.push(curr);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue