[lexical-react] Bug Fix: Fall back to root node in NodeContextMenuPlugin when click target has no Lexical node#8385
Conversation
|
Hi @mayrang! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
etrepum
left a comment
There was a problem hiding this comment.
Failing pnpm run ci-check
0b383c3 to
ed18e65
Compare
ed18e65 to
c56f93d
Compare
|
Sorry, missed running Prettier before pushing. Fixed now. |
…gin when click target has no associated Lexical node
c56f93d to
49f3178
Compare
|
As a first time contributor your checks don't run until a maintainer clicks an approval button, adding empty commits won't help anything. |
|
Got it, thanks for letting me know! I wasn't aware that first-time contributors need manual approval for CI. Sorry for the unnecessary commit. |
Description
Fixes #8257
NodeContextMenuPluginalways callspreventDefault()oncontextmenuevents, but when right-clicking on "empty" editor chrome (placeholder, padding, or DOM that doesn't map to a Lexical node),$getNearestNodeFromDOMNodereturnsnull. This results in an empty custom menu while the native context menu is suppressed.As suggested by @etrepum in #8257, this falls back to
$getRoot()when no node is found:This means:
$getRoot()fallback is never reached)$showOnfiltering, so items without$showOn(e.g. Paste) are shown instead of an empty menuTest Plan