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

Fix: right click select images #5056

Merged
merged 3 commits into from
Oct 13, 2023
Merged

Conversation

bencarletonn
Copy link
Collaborator

  • When I right click on an image, I would expect for it to be selected, similar to how MS word and google docs behave.
  • Because the image is not currently selected when right clicking, none of the context menu commands work correctly.

The current behavior

rightclickselect

The new expected behavior

rightclickselectfix

@vercel
Copy link

vercel bot commented Sep 26, 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 Oct 13, 2023 4:24pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2023 4:24pm

@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 Sep 26, 2023
Copy link
Collaborator

@ivailop7 ivailop7 left a comment

Choose a reason for hiding this comment

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

Fantastic! Thank you, Ben! @zurfyx , @fantactuka , @acywatson , you happy with this one, before I merge this one?

@fantactuka
Copy link
Contributor

I would try avoiding adding new commands into core that are not used by core itself or plain/rich text plugins. We recently spotted few commands (e.g., CLEAR_HISTORY_COMMAND) that take bundle size, but not necessarily used (which is even more likely with context menu command).

@bencarletonn
Copy link
Collaborator Author

bencarletonn commented Sep 26, 2023

I would try avoiding adding new commands into core that are not used by core itself or plain/rich text plugins. We recently spotted few commands (e.g., CLEAR_HISTORY_COMMAND) that take bundle size, but not necessarily used (which is even more likely with context menu command).

I'm happy to move the context menu command away from the core into the images plugin, however, I'd argue it belongs in the core. There's many situations where it may be useful for a node (not just an images node) to execute some logic in response to a right click. Leaving it in the core maintains this flexibility, at the expense of a few bytes.

@ivailop7
Copy link
Collaborator

I agree with Ben, the core already has the dragover, dragend, etc. events included, in my opinion it makes sense contextmenu to be alongside them, the tradeoff is worth it.

@acywatson
Copy link
Contributor

I'm not clear on why we can't do this in userland by just listening for this event. Maybe we should think about removing more of these commands from the core. Listening directly to DOM events is not a bad pattern, imo.

@ivailop7
Copy link
Collaborator

ivailop7 commented Oct 1, 2023

Ok, we'll move it to outside of core...

@ivailop7 ivailop7 closed this Oct 1, 2023
@ivailop7 ivailop7 reopened this Oct 1, 2023
@bencarletonn
Copy link
Collaborator Author

moved away from the core, apologies for the delay

Copy link
Collaborator

@ivailop7 ivailop7 left a comment

Choose a reason for hiding this comment

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

Thanks, Ben! @fantactuka , @zurfyx happy with this one?

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