facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
19.66k stars 1.67k forks source link

Bug: table can't be deleted when it has more than one colspan rows #6440

Open mrdivyansh opened 3 months ago

mrdivyansh commented 3 months ago

Lexical version: 0.16.1

Steps To Reproduce

Sample Table

Colspan row 1

Cell a

Cell b

Cell c

Cell d

Colspan row 2

  1. Visit https://playground.lexical.dev/
  2. Copy and paste the above sample table.
  3. Select the table by pressing Cmd+A
  4. Press Backspace to delete the selected table.

The current behavior

Clears the table cells

https://github.com/user-attachments/assets/47a8f27b-ec43-4864-98b1-73af52fae8cd

The expected behavior

Deletes the selected content (the table).

elbotho commented 2 months ago

I tried to reproduce this and I think the problem actually occurs if the last row has a merged table cell (no matter how many merged cells there are). Also the selection has to include only the table (usually you have a paragraph before/after). Then I can also reproduce it without copying from your issue.