1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 19:01:54 +02:00

fix example paste-html if children are empty (#4446)

Co-authored-by: Georgii Perepecho <georgii.perepecho@revolut.com>
This commit is contained in:
Georgy Perepecho
2021-08-12 22:54:01 +01:00
committed by GitHub
parent c6203a2d68
commit d32ce0f49b

View File

@@ -58,10 +58,14 @@ export const deserialize = el => {
) {
parent = el.childNodes[0]
}
const children = Array.from(parent.childNodes)
let children = Array.from(parent.childNodes)
.map(deserialize)
.flat()
if (children.length === 0) {
children = [{ text: '' }]
}
if (el.nodeName === 'BODY') {
return jsx('fragment', {}, children)
}