lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: Nested table rows are appended to parent tables when exporting DOM

Open aleksandr-lapushkin opened this issue 1 year ago • 3 comments

Lexical version: 0.18.0

Steps To Reproduce

  1. Go to Playground
  2. Insert a 2x2 table
  3. Insert another 2x2 table in any cell.
  4. 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

  1. The exported DOM has two tables
  2. The outer table has 4 columns and 4 rows
  3. The nested table has no rows

The expected behavior

  1. The exported DOM has two tables
  2. The outer table has 2 columns and 2 rows
  3. The nested table has 2 rows and 2 columns

Impact of fix

Tables cannot be reliably used until this is fixed.

aleksandr-lapushkin avatar Oct 21 '24 07:10 aleksandr-lapushkin

I can confirm this works in Lexical 0.17.1 but is broken in 0.18.0.

noahnu avatar Oct 21 '24 13:10 noahnu

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.

etrepum avatar Nov 05 '24 17:11 etrepum

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

noahnu avatar Nov 05 '24 18:11 noahnu

This should have been fixed by #6889

etrepum avatar Dec 02 '24 01:12 etrepum