From bc05f65831f84c665fd64c26edd3cd0f4fa4613a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niko=20Kova=C4=8Di=C4=8D?= Date: Thu, 25 Mar 2021 06:42:54 +0100 Subject: [PATCH] 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. --- docs/concepts/09-serializing.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/concepts/09-serializing.md b/docs/concepts/09-serializing.md index ef2bd0c93..86d4a8f8b 100644 --- a/docs/concepts/09-serializing.md +++ b/docs/concepts/09-serializing.md @@ -166,6 +166,10 @@ const deserialize = el => { } const children = Array.from(el.childNodes).map(deserialize) + + if (children.length === 0) { + children = [{ text: '' }] + } switch (el.nodeName) { case 'BODY':