From b64fbd06d3ac4fb1083b3e74fb724238de7ab90b Mon Sep 17 00:00:00 2001 From: Ulion Date: Thu, 1 Apr 2021 06:25:09 +0800 Subject: [PATCH] Fix move_node caused full re-render. (#4120) --- packages/slate-react/src/plugin/with-react.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/slate-react/src/plugin/with-react.ts b/packages/slate-react/src/plugin/with-react.ts index ed22c52a0..48ad82f7e 100644 --- a/packages/slate-react/src/plugin/with-react.ts +++ b/packages/slate-react/src/plugin/with-react.ts @@ -78,7 +78,12 @@ export const withReact = (editor: T) => { } case 'move_node': { - // TODO + for (const [node, path] of Editor.levels(e, { + at: Path.common(Path.parent(op.path), Path.parent(op.newPath)), + })) { + const key = ReactEditor.findKey(e, node) + matches.push([path, key]) + } break } }