-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
horizontal-rule extension throws "RangeError: Position x out of range" #2117
Comments
@philippkuehn is there any chance you could say a little bit about what this error indicates? I have just experienced the same error and it made my editor state completely corrupt. I have not been able to reproduce it since, but knowing what the error means may help me reproduce it... |
@duhaime Assuming your document has a size of |
Thank you! I found an edge case where the mentions plugin can generate one of these consistently. If it looks like there's something we can patch in the core I'll follow up (likely I've mangled something in my extensions of the Mention) |
@duhaime Maybe this has been fixed already by this patch: #2413 (comment) |
@philippkuehn ah that could be! Is that patch deployed on https://tiptap.dev/api/nodes/mention? I created #2490 to discuss the reproducible scenario that will trigger this exception... |
What’s the bug you are facing?
The horizontal-rule extension throws a RangeError in certain positions. The reproduction is in an unlikely set of circumstances and/or a position that should be invalid. But I discovered this reproducible case as I have a method checking the editor's commands if they
can()
at a given time in order to disable the command in the toolbar.The same error is thrown when either the chained command or can() are executed with
setHorizontalRule()
.How can we reproduce the bug on our side?
Steps to reproduce (see codesandbox):
Error will be thrown.
Can you provide a CodeSandbox?
https://codesandbox.io/s/tiptap-horizontal-rule-error-8fzj4?file=/src
What did you expect to happen?
editor.can().setHorizontalRule()
would run -- returning a Boolean -- without throwing an error.editor.chain().focus().setHorizontalRule().run()
would run -- inserting or not inserting the horizontal rule -- without throwing an error.Anything to add? (optional)
The codesandbox uses the starter-kit (throws some deprecation warnings from the bubble/floating menus), but it is reproducible in my production app (using a week old packages) and my dev environment using freshly installed versions of the following.
It may be important to point out that this is using the vue2 package.
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: