Skip to content

Commit

Permalink
Fix $restoreEditorState (facebook#3842)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Feb 7, 2023
1 parent f81af3f commit 0baf79d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/lexical-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,14 @@ export function $restoreEditorState(
editorState: EditorState,
): void {
const FULL_RECONCILE = 2;
const nodeMap = new Map(editorState._nodeMap);
const nodeMap = new Map();
const activeEditorState = editor._pendingEditorState;

for (const [key, node] of editorState._nodeMap) {
// @ts-ignore
nodeMap.set(key, node.constructor.clone(node));
}

if (activeEditorState) {
activeEditorState._nodeMap = nodeMap;
}
Expand Down

0 comments on commit 0baf79d

Please sign in to comment.