[Bug]: Dropping text in front of a table produces a broken, empty table #6074
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Type: Bug
The issue or pullrequest is related to a bug
Affected Packages
core
Version(s)
Any version released in the last year (at least)
Bug Description
When dropping text, prosemirror attempts to calculate the insert position via posAtCoords. In this case, it uses the element's bounding box. So if the cursor gets there, rather than adjusting the position, it assumes that the insertion occurs at the depth level of the table rows and looks for suitable neighbors for the new element and finds tableRow.
A table that is created in this way is invisible and broken. It cannot be deleted via Backspace (throws error), properly selected, etc. To reproduce it, you can just go to the example from the tiptap website
There are many places where it is possible to handle this case both in prosemirror modules and outside the prosemirror logic, although it should probably be considered as a bug of prosemirror itself.
Screen.Recording.2025-01-31.at.11.10.42.mov
Browser Used
Chrome
Code Example URL
https://tiptap.dev/docs/examples/basics/tables
Expected Behavior
The text is inserted before the table and no new tables are created.
Additional Context (Optional)
No response
Dependency Updates
The text was updated successfully, but these errors were encountered: