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]: RangeError Position x outside of fragment when deleting text from draggable paragraph #5203

Open
1 task done
ArlatPS opened this issue Jun 3, 2024 · 1 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

Comments

@ArlatPS
Copy link

ArlatPS commented Jun 3, 2024

Affected Packages

core, react, extension-paragraph

Version(s)

2.4.0

Bug Description

When more than last paragraph is selected by cursor starting from the end (it has to be from the end, otherwise it works fine) and backspace is pressed Range Error Position x outside of fragment occurs.
Paragraph is custom and it extends @tiptap/extension-paragraph and uses ReactNodeViewRenderer with NodeViewContent and NodeViewWrapper.
If the component is set to draggable: false the issue does not occur.
Code Sandbox is provided with bug present.
From what I've found the error occurs at:

() => commands.deleteSelection(),

Browser Used

Chrome

Code Example URL

https://codesandbox.io/p/sandbox/upbeat-dew-68ntql?file=%2Fsrc%2FApp.js%3A41%2C176

Expected Behavior

Expected to delete fragment of the text.

Additional Context (Optional)

draggable-paragraph-bug.mov

Dependency Updates

  • Yes, I've updated all my dependencies.
@ArlatPS ArlatPS 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 Jun 3, 2024
@cheemooo
Copy link

@ArlatPS Perhaps you can try the following temporary solution.

addKeyboardShortcuts() {
  return {
    Delete: () => {
      this.editor.view.dragging = null;
    },
    Backspace: () => {
      this.editor.view.dragging = null;
    },
  };
},

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

No branches or pull requests

2 participants