Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve selection for pending state #3293

Merged
merged 1 commit into from
Oct 31, 2022
Merged

Conversation

fantactuka
Copy link
Contributor

In non-headless mode there's a separate logic that either reuses previous selection or relies on dom. For headless we just copy previous selection

@vercel
Copy link

vercel bot commented Oct 31, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Oct 31, 2022 at 1:48PM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Oct 31, 2022 at 1:48PM (UTC)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 31, 2022
@zurfyx zurfyx merged commit b829f49 into main Oct 31, 2022
@@ -809,6 +809,8 @@ function beginUpdate(
try {
if (editorStateWasCloned && !editor._headless) {
pendingEditorState._selection = internalCreateSelection(editor);
} else if (editor._headless && currentEditorState._selection != null) {
pendingEditorState._selection = currentEditorState._selection.clone();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the editor state wasn't cloned then should you be mutating it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right, will fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants