Skip to content
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

Bug: Inserting a table from external source can lead to Lexical crash #5662

Closed
vect-spasquereau opened this issue Feb 28, 2024 · 5 comments · Fixed by #5670
Closed

Bug: Inserting a table from external source can lead to Lexical crash #5662

vect-spasquereau opened this issue Feb 28, 2024 · 5 comments · Fixed by #5670

Comments

@vect-spasquereau
Copy link
Contributor

Hello there. I'm working with lexical tables and I was trying to implement background color control. I was testing with tables copied from external resources (google doc, google spreadsheet). Lexical is able to import the tables, but is crashing when I trying to leave the table.

Lexical version: 0.13.1

Steps To Reproduce

  1. Go in Google doc, insert a table and copy it
  2. Paste it into Lexical
  3. Go to last cell and press the right arrow to focus the table end
  4. Press Enter to insert a paragraph underneath the table
  5. Lexical is crashing

https://www.loom.com/share/dc72b967351a49afa1de3e5f0d1d7b66?sid=c3b11039-a4fd-4877-a176-74204fd36c4a

Link to code example: reproductible in Lexical playground

After investigation, I think Lexical is going in an infinite loop in LexicalSelection -> removeTextAndSplitBlock
(@birtles I think you've been working on this 👀)

@birtles
Copy link
Contributor

birtles commented Feb 29, 2024

@vect-spasquereau Sorry I'm on leave at the moment so I haven't had a chance to dig through old issues but did I mention working on something like that? Or did I cause a regression here?

@vect-spasquereau
Copy link
Contributor Author

@birtles sorry I didn't notice you are on leave. I just checked the file history and saw you were the last one implementing/refactoring the LexicalSelection -> removeTextAndSplit and LexicalSelection -> splitNodeAtPoint functions. I assumed it could mean something for you 🙂
Nevermind, it's an edge case, I'll try to come up with a fix to break this infinite loop

@vect-spasquereau
Copy link
Contributor Author

vect-spasquereau commented Feb 29, 2024

well, that was a wrong lead. Fixing the convertTableCellNodeElement method when copying tables from external sources.

@vect-spasquereau
Copy link
Contributor Author

#5670

@birtles
Copy link
Contributor

birtles commented Mar 2, 2024

@birtles sorry I didn't notice you are on leave.

Not at all! GitHub doesn't make that information very visible.

I just checked the file history and saw you were the last one implementing/refactoring the LexicalSelection -> removeTextAndSplit and LexicalSelection -> splitNodeAtPoint functions. I assumed it could mean something for you 🙂 Nevermind, it's an edge case, I'll try to come up with a fix to break this infinite loop

I'm afraid I haven't touched lexical code since that patch. It sounds like you worked it out though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants