Medium.js
Medium.js copied to clipboard
Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range':
I'm getting this error after typing a few letters. Any ideia what could it be? I'm using Chrome 37.0.2062.94. Thanks!
Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': There is no child at offset 2.
Can you tell me which options, mode, and behavior you are using? On Sep 5, 2014 10:26 PM, "Matheus Bras Quaresma" [email protected] wrote:
I'm getting this error after typing a few letters. Any ideia what could it be? I'm using Chrome 37.0.2062.94. Thanks!
Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': There is no child at offset 2.
— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/82.
@robertleeplummerjr I'm using with the default options, just passing the element.
So then you are using the demo's? If so, which example?
On Fri, Sep 19, 2014 at 7:48 PM, Matheus Bras Quaresma < [email protected]> wrote:
@robertleeplummerjr https://github.com/robertleeplummerjr I'm using with the default options, just passing the element.
— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/82#issuecomment-56249394.
Robert Plummer
I'm having the same problem.
Building inside a React component and enabling in either componentDidMount or componentDidUpdate.
The options I'm using are:
new Medium({
element: this.getDOMNode().querySelector('.preview-content'),
mode: Medium.richMode,
autoHR: false,
cssClasses: {
editor: 'edit-mode',
}
})
All works fine until you delete the node's innerText and start typing again, at which point the caret jumps around and ends up at the start of the node.
Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range':
There is no child at offset 2.medium.js:1404 Medium.Cursor.setmedium.js:1305
Medium.Utilities.setupContentsmedium.js:1601
Medium.HtmlAssistant.placeholdersmedium.js:240 intercept.up
Currently on Chrome:39
Same error in partialMode.. inlineMode works fine.. the bug only happens after typing a few characters fairly quickly
edit: no it happens when creating slowly.. seems that when the first
is added the range gets messed up.
Bug also happens in Rich mode demo.
This makes it work
tags: {
paragraph: null
}
but now inserting unnecessary <div>
tags where a <br>
would be more suitable for the text content. Also seems hacky, if more complex behaviour would be introduced for e.g. highlighting the first word.
What are the exact steps to reproduce?
Click on the editor for the rich editor in your demo, press delete twice (you'll see the caret position change slightly despite their being no text), then type three characters very quickly.
From then on - the error happens seemingly randomly in your demo but more consistently in other implementations. The first page load can produce the error consistently.
Try latest from master.
On Sat, Jan 24, 2015 at 1:43 PM, Thomas [email protected] wrote:
Click on the editor for the rich editor in your demo, press delete twice (you'll see the caret position change slightly despite their being no text), then type three characters very quickly.
From then on - the error happens seemingly randomly in your demo but more consistently in other implementations. The first page load can produce the error consistently.
— Reply to this email directly or view it on GitHub https://github.com/jakiestfu/Medium.js/issues/82#issuecomment-71331560.
Robert Plummer
Mmm did you bump the version at all after making this change? I'm noticing no difference for my implementation.
edit: your demo page still performs exactly the same too
Here's a video demonstrating the behaviour - you can see the code used to implement and the current version tracked by npm.
Any fixes on that? Having the same issue here..
Same for me, I get this when trying to set a value or typing in anything but inlineMode.
I was encountering this issue when trying to wrap it in a medium directive and using any mode other than inline.
@vkovalskiy @levity I found a different, probably more hacky workaround: https://github.com/FranzSkuffka/innovant/blob/firebase-wip/assets/libs/medium.js#L1404
just wrap the call in a try / catch construct and things will work as expected.
For what it's worth, I also just ran into a very similar issue (mine was an Uncaught DOMexception Failed to execute 'setEnd' on 'Range': The offset 1 is larger than or equal to the node's length (0)
).
The problem for me was caused by a Chrome extensions that was going in and modifying the DOM elements on the page under codemirror's nose (in my case it was this text url to clickable url extension - which would break codemirror if I had a URL in the editor contents).
Disabling that extension resolved the issue for me.