1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-19 14:44:39 +01: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
}