[Breaking Change][lexical-table] Bug Fix: Prevent nested tables#7192
[Breaking Change][lexical-table] Bug Fix: Prevent nested tables#7192etrepum merged 4 commits intofacebook:mainfrom
Conversation
Disable the ability to create nested tables by preventing: - Table insertion inside table cells - Table paste operations within cells Fixes facebook#7154
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
- Remove tests for nested table navigation since nested tables are no longer supported - Add comment explaining the removal and referencing the issue Fixes facebook#7154
etrepum
left a comment
There was a problem hiding this comment.
The code looks good but there are some simplifications we can apply before merge.
I think this is probably a net good change. It's small, isolated, has tests, and mostly prevents tables from being inserted in the UI without gutting the partial support for nested tables that exists elsewhere.
There are probably other situations where you could create tables programmatically, but rather than taking more extreme approaches (e.g. a transform) it probably makes sense to just chip away at nested table support. I think most of the work is handling DOM related issues with navigation (which probably shouldn't rely so much on DOM in this case).
Something that is probably going to come up is when a user pastes HTML with nested tables, the nested content is just going to disappear. We might want to accompany this change with some additional documentation somewhere that they should handle these cases in importDOM until nested tables are supposed.
- Simplify nested table checks using helper Per review feedback, simplified the code checks for nested tables. Co-authored-by: Bob Ippolito <bob@redivi.com>
Add documentation about how nested table content is handled during paste operations and provide guidance on using importDOM to preserve nested table content until proper nested table support is implemented. Co-authored-by: Bob Ippolito <bob@redivi.com>
Thanks for the detailed review @etrepum! I've updated the README to document the handling of nested tables, particularly focusing on the
I haven't included specific code examples yet. Would you like me to add some practical examples of Let me know if you'd like any adjustments to the documentation or if there are other aspects we should cover. |
etrepum
left a comment
There was a problem hiding this comment.
I think this level of documentation is totally sufficient, no need to go through the trouble of implementing that example code in this PR
Description
Current behavior:
Changes being added:
INSERT_TABLE_COMMANDSELECTION_INSERT_CLIPBOARD_NODES_COMMANDTablePluginTables.spec.mjsto verify user interactionsCloses #7154
Breaking Changes
Nested tables have never worked correctly, but there was partial "support" for them in the code. While it may make sense to support them in the future, a safer default behavior is to prevent their use until the infrastructure is in place to support them.
Test plan
Before
lexical-7154-bug.mov
After
lexial-7154-fix.mov