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:
@@ -58,10 +58,14 @@ export const deserialize = el => {
|
|||||||
) {
|
) {
|
||||||
parent = el.childNodes[0]
|
parent = el.childNodes[0]
|
||||||
}
|
}
|
||||||
const children = Array.from(parent.childNodes)
|
let children = Array.from(parent.childNodes)
|
||||||
.map(deserialize)
|
.map(deserialize)
|
||||||
.flat()
|
.flat()
|
||||||
|
|
||||||
|
if (children.length === 0) {
|
||||||
|
children = [{ text: '' }]
|
||||||
|
}
|
||||||
|
|
||||||
if (el.nodeName === 'BODY') {
|
if (el.nodeName === 'BODY') {
|
||||||
return jsx('fragment', {}, children)
|
return jsx('fragment', {}, children)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user