From 6b1ff526eb5d3e557bc6382d0a75dbcd470b9c42 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 10 Apr 2022 13:54:25 +0800 Subject: [PATCH] fix: empty value --- packages/client/src/slate/RichText.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/slate/RichText.tsx b/packages/client/src/slate/RichText.tsx index f6f0bc71d..5a36b04b1 100644 --- a/packages/client/src/slate/RichText.tsx +++ b/packages/client/src/slate/RichText.tsx @@ -30,7 +30,7 @@ export const RichText = (props: any) => { const renderLeaf = useCallback((props) => , []); const editor = useMemo(() => withHistory(withReact(createEditor() as ReactEditor)), []); const slateValue = useMemo(() => { - editor.children = JSON.parse(JSON.stringify(value)); + editor.children = JSON.parse(JSON.stringify(value || [])); Editor.normalize(editor, { force: true }); return editor.children; }, [editor, value]);