lexical
lexical copied to clipboard
Bug: Nested table rows are appended to parent tables when exporting DOM
Lexical version: 0.18.0
Steps To Reproduce
- Go to Playground
- Insert a 2x2 table
- Insert another 2x2 table in any cell.
- Export DOM
https://github.com/user-attachments/assets/f27b4087-c7b2-4020-85df-6103894170b6
Link to faulty code: https://github.com/facebook/lexical/blob/b2d57a0162671ab339a3b6bb578218d916ff2131/packages/lexical-table/src/LexicalTableNode.ts#L185
The current behavior
- The exported DOM has two tables
- The outer table has 4 columns and 4 rows
- The nested table has no rows
The expected behavior
- The exported DOM has two tables
- The outer table has 2 columns and 2 rows
- The nested table has 2 rows and 2 columns
Impact of fix
Tables cannot be reliably used until this is fixed.
I can confirm this works in Lexical 0.17.1 but is broken in 0.18.0.
I don't think that nested tables are currently well supported, I'm sure there are a number of related edge cases. If you are interested in this feature I suggest that you look into contributing PRs to implement better tests and support for them.
I don't think that nested tables are currently well supported, I'm sure there are a number of related edge cases. If you are interested in this feature I suggest that you look into contributing PRs to implement better tests and support for them.
FWIW, I've been using nested tables extensively for the past few versions. We haven't had any issues with edge cases until this particular issue. I'd be happy to contribute some test coverage + fixes if @aleksandr-lapushkin doesn't get to it first
This should have been fixed by #6889