You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Very simple repro, you can see it on the ProseMirror.net homepage demo.
Focus the editor (for the exact error below, I put it at the end of the text), run the following code in devtools…
document.execCommand("insertText", false, "This is a test...")
…and you'll get an error:
prosemirror.js:1 Uncaught RangeError: Position 81 out of range
at k.resolve (prosemirror.js:1:13673)
at k.resolveCached (prosemirror.js:1:14052)
at N.resolve (prosemirror.js:1:16564)
at ft.insertText (prosemirror.js:1:83263)
at ri.handler (prosemirror.js:1:185603)
at ii (prosemirror.js:1:186335)
at kt.handleTextInput (prosemirror.js:1:185856)
at prosemirror.js:1:172147
at EditorView.someProp (prosemirror.js:1:179785)
at Io (prosemirror.js:1:172116)
In this case the ri.handler line is this line in the stringHandler function in inputrules.ts
This might seem contrived, but I stumbled on it debugging a failure in one of our automated tests which uses Playwright. I'm not sure if they are using execCommand exactly, or just simulating keystrokes very quickly, but the result is the same.
I didn't have time to dive into exactly what the root cause is, but I suspect it'll be obvious[-ish] to someone with more context about the plugin.
💛 ProseMirror is one of the most well-engineered libraries I've ever used. It's reliable and flexible - a joy to work with. And I've learned a lot from spelunking in the source, which is remarkably easy to follow given the complexity of the problem space. Thanks for all the time, energy, and good taste you've put into it!
The text was updated successfully, but these errors were encountered:
jrpat
changed the title
[Bug] InputRules plugin errors if replacement text is inserted very quickly
[Bug] InputRules plugin errors if replaceable text is inserted very quickly
Feb 13, 2025
Very simple repro, you can see it on the ProseMirror.net homepage demo.
Focus the editor (for the exact error below, I put it at the end of the text), run the following code in devtools…
…and you'll get an error:
In this case the
ri.handler
line is this line in thestringHandler
function in inputrules.tsThis might seem contrived, but I stumbled on it debugging a failure in one of our automated tests which uses Playwright. I'm not sure if they are using
execCommand
exactly, or just simulating keystrokes very quickly, but the result is the same.I didn't have time to dive into exactly what the root cause is, but I suspect it'll be obvious[-ish] to someone with more context about the plugin.
💛 ProseMirror is one of the most well-engineered libraries I've ever used. It's reliable and flexible - a joy to work with. And I've learned a lot from spelunking in the source, which is remarkably easy to follow given the complexity of the problem space. Thanks for all the time, energy, and good taste you've put into it!
The text was updated successfully, but these errors were encountered: