[Bug]: Insert Table Command Uncaught Range Error #5143
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
extension-table
Version(s)
2.3.2
Bug Description
The issue occurs when the editor has content that exceeds the size of the table you are about to insert.
For example the node size of a 3x3 table with paragraphs in each cell is 44.
If your doc node's content exceeds 44, using your mouse make a selection from the end of the doc to the beginning.
And then call
insertTable({ row: 3, cols: 3 })
.See that there is an Uncaught Range Error
![image](https://private-user-images.githubusercontent.com/54958000/330231551-ae76d35d-0c02-4904-beed-e4c8b4484f5a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NjIzNDQsIm5iZiI6MTczOTk2MjA0NCwicGF0aCI6Ii81NDk1ODAwMC8zMzAyMzE1NTEtYWU3NmQzNWQtMGMwMi00OTA0LWJlZWQtZTRjOGI0NDg0ZjVhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDEwNDcyNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI0MjNmOTI2YWNkOGJkMzJlNWFiMDJlNzY3MTc5M2NkNjgwOTUwM2JlNTZjZmI2ZDUwY2FiOWVkOWYwN2JkZTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cV5gwQqY56YCr5XVrDmJk_wSZA9_-_3jMjlioYQoW0I)
See the sandbox link to see these steps in action.
From the code it looks like the error is from resolving a position that we want to set the selection to after inserting the table.
Browser Used
Chrome
Code Example URL
https://codesandbox.io/p/sandbox/friendly-leavitt-x33m7q
Expected Behavior
No error when inserting the table.
I'm not sure where the selection should be though after inserting the table..
Additional Context (Optional)
No response
Dependency Updates
The text was updated successfully, but these errors were encountered: