-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[lexical-table] Bug Fix: Resolve table selection issue when the mouse crosses over a portal #6834
Merged
etrepum
merged 25 commits into
facebook:main
from
etrepum:table-cell-action-button-selection
Nov 24, 2024
Merged
[lexical-table] Bug Fix: Resolve table selection issue when the mouse crosses over a portal #6834
etrepum
merged 25 commits into
facebook:main
from
etrepum:table-cell-action-button-selection
Nov 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
etrepum
requested review from
zurfyx,
fantactuka,
acywatson,
Fetz,
ivailop7,
Sahejkm and
potatowagon
as code owners
November 14, 2024 19:21
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
Nov 14, 2024
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
…e state of this thing
…ion' into table-cell-action-button-selection
…ble-cell-action-button-selection
ivailop7
approved these changes
Nov 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work! Really well done, Bob!
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.
extended-tests
Run extended e2e tests on a PR
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When using table selection by mouse movement, if the mouse crosses over an element that is outside of the document, it ends up creating a native selection that messes up the intended table selection.
Unfortunately when researching this bug I accidentally learned how much of a tangled un-idiomatic mess this plugin is and I couldn't figure out how to fix it without a larger refactoring. The primary anti-patterns are basically nested and cascading updates.
For whatever historical reason, lexical uses the most error-prone design imaginable for nested updates, so they should be avoided at all cost (surprisingly,
dispatchCommand
avoids this issue by working in the manner that nested updates should have been implemented). TableObserver's methods are primarily used inside updates, but because sometimes they are called from mouse events they all have an expliciteditor.update
which is a mistake. I've renamed them all to$methods
to be explicit on their dependencies and how to use them.By doing this in a way that actually makes sense for Lexical, we will probably fix some bugs we don't know about yet, remove the cascading updates, and remove the setTimeout nonsense that was used to work around the nested and cascading updates.
This is not a complete refactor, just enough to get things working. I'm sure more logic could be cleaned up here, especially regarding nested tables.
Closes #6820
Closes #6861 (the code from that PR is also here)
Test plan
Before
table-action-cell-button-select.mov
After
table-action-cell-button-hide.mov