mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-02 17:34:49 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find back-to-back <br><br> at the top level and de-duplicate them
|
// Find back-to-back <br><br> at the top level and de-duplicate them. Note that
|
||||||
const { children } = doc.body;
|
// some emails contain TEXT<br>TEXT<br>TEXT, so the only ELEMENT children may be the <brs>
|
||||||
|
const nodes = doc.body.childNodes;
|
||||||
const extraTailBrTags = [];
|
const extraTailBrTags = [];
|
||||||
for (let i = children.length - 1; i >= 0; i--) {
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
||||||
const curr = children[i];
|
const curr = nodes[i];
|
||||||
const next = children[i - 1];
|
const next = nodes[i - 1];
|
||||||
if (curr && curr.nodeName === 'BR' && next && next.nodeName === 'BR') {
|
if (curr && curr.nodeName === 'BR' && next && next.nodeName === 'BR') {
|
||||||
extraTailBrTags.push(curr);
|
extraTailBrTags.push(curr);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue