-
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: Selection in tables with merged cells #6529
[lexical-table] Bug Fix: Selection in tables with merged cells #6529
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
@elbotho thanks for helping out on this. I think the last surface when it comes to table bugs is 'merged cells selection'. If you are motivated to help out clear those issues (all tagged with 'tables') nicely with a better refactor, it would be very welcome. |
Is this a no to the quickfix? I see 12 issues with the table tag and around 4-5 seem to relate directly to merged cells and or selection. Are you refering to those? |
I'm OK to merge this PR, despite the lack of tests, since it doesn't seem to make things worse, but it would be nice to have a proper fix, even if it takes longer. Yes, I'm refering to those 4-5 issues that are all the same issue essentially. |
Thank you @ivailop7! |
Description
Quickfix for #6515
As described in the issue currently changing the selection using the arrow keys can throw an error that crashes the editor.
(Error:
Uncaught Error: Node at cords not TableCellNode.
)Describe the changes in this pull request
This quickfix works quite well for merged cells at the end of a row (most common cases imo)
For merged cells at the beginning or the middle of a row this simple approach creates some unexpected cursor jumps. But instead of crashing the user can be easily adapt the position and the editor won't break.
(For a full fix the positions would need to consider the colspan everywhere in the table plugin, that would be a bigger refactoring I guess).
I did check where this function is used and did some manual testing and did not encounter unwanted side effects, but this is also my first glance inside the lexical codebase :)
Fingers crossed.
Test plan
Before
After