Skip to content

Commit

Permalink
Merge pull request #13503 from ahmdshrif/fix/email-new-line
Browse files Browse the repository at this point in the history
fix: email new line by skipping extra div
  • Loading branch information
Julesssss committed Dec 16, 2022
2 parents 1e0be12 + 725f4ae commit fde8d11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libs/SelectionScraper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ const replaceNodes = (dom) => {
if (htmlEngineUtils.isCommentTag(dom.attribs[tagAttribute])) {
dom.children.push(new Element('br', {}));
}
} else if (dom.name === 'div' && dom.children.length === 1 && dom.children[0].type !== 'text') {
// We are excluding divs that have only one child and no text nodes and don't have a tagAttribute to prevent
// additional newlines from being added in the HTML to Markdown conversion process.
return replaceNodes(dom.children[0]);
}

// We need to preserve href attribute in order to copy links.
Expand Down

0 comments on commit fde8d11

Please sign in to comment.