diff --git a/packages/core/src/parse-html/parse-elem-html.ts b/packages/core/src/parse-html/parse-elem-html.ts
index 4dc66c02f..17b124e5e 100644
--- a/packages/core/src/parse-html/parse-elem-html.ts
+++ b/packages/core/src/parse-html/parse-elem-html.ts
@@ -49,13 +49,23 @@ function parseElemHtml($elem: Dom7Array, editor: IDomEditor): Descendant | Desce
if (isDOMElement(childNode)) {
const elem = parseElemHtml($childElem, editor)
- return Array.isArray(elem) ? [...descendants, ...elem] : [...descendants, elem]
+ if (Array.isArray(elem)) {
+ descendants.push(...elem)
+ } else {
+ descendants.push(elem)
+ }
+ } else {
+ const text = isDOMText(childNode)
+ ? { text: (childNode as Text).textContent || '' }
+ : parseTextElemHtml($childElem, editor)
+
+ descendants.push(text)
}
- const text = isDOMText(childNode) ? { text: (childNode as Text).textContent || '' } : parseTextElemHtml($childElem, editor)
- return [...descendants, text]
+ return descendants
}, [] as Descendant[])
}
+
return parseTextElemHtml($elem, editor)
}