Skip to content

Commit

Permalink
[+] convertFromHtml span with whitespace
Browse files Browse the repository at this point in the history
[*] span with inlineStyle and once whitespace
  • Loading branch information
freeday committed Dec 10, 2021
1 parent fce77c1 commit f706f4e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/convertFromHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,17 @@ function genFragment(
inlineStyle = processInlineTag(nodeName, node, inlineStyle);
inlineStyle = processCustomInlineStyles(nodeName, node, inlineStyle);

if (nodeName === 'span' && (node.textContent === SPACE || node.textContent === NBSP || node.textContent === '\s')) {
// When tag <span> </span> with only whitespace
let text = node.textContent
return {
text,
inlines: Array(text.length).fill(inlineStyle),
entities: [],
blocks: [],
}
}

// Handle lists
if (nodeName === 'ul' || nodeName === 'ol') {
if (lastList) {
Expand Down

0 comments on commit f706f4e

Please sign in to comment.