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:
@@ -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':
|
||||||
|
Reference in New Issue
Block a user