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]: Insert Table Command Uncaught Range Error #5143

Open
1 task done
wilson-everlaw opened this issue May 13, 2024 · 0 comments · May be fixed by #5151
Open
1 task done

[Bug]: Insert Table Command Uncaught Range Error #5143

wilson-everlaw opened this issue May 13, 2024 · 0 comments · May be fixed by #5151
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

Comments

@wilson-everlaw
Copy link

wilson-everlaw commented May 13, 2024

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.

image

And then call insertTable({ row: 3, cols: 3 }).

See that there is an Uncaught Range Error
image

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

  • Yes, I've updated all my dependencies.
@wilson-everlaw wilson-everlaw added 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 labels May 13, 2024
wilson-everlaw added a commit to wilson-everlaw/tiptap that referenced this issue May 14, 2024
…table

Typically when inserting a new table we want to select within the first cell of the newly inserted
table. This change should ensure that occurs even if original selection's head precedes the anchor.

fix ueberdosis#5143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Triage open
Development

Successfully merging a pull request may close this issue.

1 participant