From 5f491fca4d2b0f85f2d59d3ae11ce86939d75e59 Mon Sep 17 00:00:00 2001 From: Dmitrii Pikulin Date: Fri, 11 Mar 2022 09:32:11 +0400 Subject: [PATCH 1/2] Assign value to editor children --- packages/slate-editor/src/modules/editor-v4/EditorV4.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx b/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx index eefc80f02..1467e8b81 100644 --- a/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx +++ b/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx @@ -140,6 +140,10 @@ const EditorV4: FunctionComponent = (props) => { plugins, }); + React.useEffect(() => { + editor.children = value; + }, [value]); + useEffect(() => { if (autoFocus) { EditorCommands.focus(editor); From 65fd7a07553471e92005035aaf1ba80524de0618 Mon Sep 17 00:00:00 2001 From: Dmitrii Pikulin Date: Fri, 11 Mar 2022 13:18:47 +0400 Subject: [PATCH 2/2] FIx code review --- packages/slate-editor/src/modules/editor-v4/EditorV4.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx b/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx index 1467e8b81..99e07f535 100644 --- a/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx +++ b/packages/slate-editor/src/modules/editor-v4/EditorV4.tsx @@ -140,7 +140,7 @@ const EditorV4: FunctionComponent = (props) => { plugins, }); - React.useEffect(() => { + useEffect(() => { editor.children = value; }, [value]);