Skip to content

Commit

Permalink
Keep selection if state was not cloned (facebook#3294)
Browse files Browse the repository at this point in the history
  • Loading branch information
fantactuka authored Oct 31, 2022
1 parent b829f49 commit fa2f31e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/lexical/src/LexicalUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,14 @@ function beginUpdate(
activeEditor = editor;

try {
if (editorStateWasCloned && !editor._headless) {
pendingEditorState._selection = internalCreateSelection(editor);
} else if (editor._headless && currentEditorState._selection != null) {
pendingEditorState._selection = currentEditorState._selection.clone();
if (editorStateWasCloned) {
if (editor._headless) {
if (currentEditorState._selection != null) {
pendingEditorState._selection = currentEditorState._selection.clone();
}
} else {
pendingEditorState._selection = internalCreateSelection(editor);
}
}

const startingCompositionKey = editor._compositionKey;
Expand Down

0 comments on commit fa2f31e

Please sign in to comment.