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

Extract "select all" behavior to new SELECT_ALL_COMMAND #4818

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

montlebalm
Copy link
Contributor

Move the "select all" behavior from LexicalEvents into a new SELECT_ALL_COMMAND. This will make overriding the default behavior easier for developers and matches the way that commands like copy, paste, arrow up, etc are handled.

Overriding "select all" is not common, but several applications have introduced context-aware versions of the behavior that are difficult to change with lexical's current implementation. For example, an editor may choose to have the first invocation of ⌘ + a select the current paragraph and a subsequent ⌘ + a select the entire document.

@vercel
Copy link

vercel bot commented Jul 24, 2023

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

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2023 10:36pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2023 10:36pm

@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 Jul 24, 2023
Copy link
Contributor

@fantactuka fantactuka left a comment

Choose a reason for hiding this comment

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

👍

@acywatson
Copy link
Contributor

I'm good with this, but I think if someone is using LexicalEvents directly (looks like this can be called via setRootElement) this could break them. I don't think this is a common case, but might be more common outside in vanilla js implementations.

I think we might want to version bump unless I'm wrong about this.

@acywatson acywatson merged commit 5aa1230 into facebook:main Aug 7, 2023
@acywatson acywatson mentioned this pull request Aug 9, 2023
@acdcjunior
Copy link

Sorry for hijacking the thread, but on the off chance anyone also gets issues after upgrading lexical: in my case dependabot created a PR that updated lexical from 0.11.3 to 0.12.0 and suddenly CTRL+A stopped working, even though I used RichTextPlugin.

What was causing this? In my case @lexical/react was still pointing to 0.11.3. Updating it to 0.12.0 (so that both lexical and @lexical/react now point to 0.12.0) fixed the issue.

Which makes sense since this PR changes multiple packages.

Anyway, HTH.

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.

5 participants