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

Add empty text if children are empty (#3889)

If line 170 is not added issues like https://github.com/ianstormtaylor/slate/issues/3625 start surfacing. 
Because the deserialize example is mostly directly copy-pasted into projects, the added line would save many head-scratching down the lane.
This commit is contained in:
Niko Kovačič
2021-03-25 06:42:54 +01:00
committed by GitHub
parent c52dcd330b
commit bc05f65831

View File

@@ -166,6 +166,10 @@ const deserialize = el => {
} }
const children = Array.from(el.childNodes).map(deserialize) const children = Array.from(el.childNodes).map(deserialize)
if (children.length === 0) {
children = [{ text: '' }]
}
switch (el.nodeName) { switch (el.nodeName) {
case 'BODY': case 'BODY':