Error: The given range isn't in document
See original GitHub issueI noticed an annoying The given range isn't in document
error during text editing in Chrome. I found one way to reproduce the problem in the Quill demo on your website so I guess this means this is a problem in Quill and not in my code.
Steps for Reproduction
- Visit quilljs.com and switch to the third demo (The one where you can set a text color).
- Click into the text area to focus the editor.
- Select all text with
Ctrl-A
. - Remove selected text with
Del
. The document must be completely empty now. - Select a text color with the color picker in the toolbar.
- Type multiple lines of text (Can’t be reproduced with just one line).
- Select all content again with
Ctrl-A
. - Type new text.
Expected behavior:
The new text must replace the selected text.
Actual behavior:
The selected text is removed, the error message The given range isn't in document
is thrown and the editor looses the focus.
Platforms: Chrome 63.0.3239.132 on Debian Linux 9.3
Version: 1.3.5
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:51 (1 by maintainers)
Top Results From Across the Web
React-Quill - addRange(): The given range isn't in document
I was able to solve it by updating the value of value to editor.getContents() inside the onChange callback, which is called back with...
Read more >Fab Follow - CodePen
Quill Playground : The given range isn't in document issue (https://github.com/quilljs/quill/issues/1134) · Fab Follow. Love Run. Pen Editor Menu. Settings ...
Read more >The given range isn't in document - Atlassian Community
The given range isn't in document ... Looks like when cursor focus not on the editor, it could not get the range from...
Read more >React-Quill - addRange(): The given range isn't in document ...
[Solved]-React-Quill - addRange(): The given range isn't in document-Reactjs. use literal object as modules props, it will trigger component rerender , use ...
Read more >react quill gains focus on hover - Knovigator
upgrading to react-quill@beta caused the addRange errors. Gravatar for undefined ... Error: The given range isn't in document · Issue #1940 · quilljs/quill....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I solve this issue by caching the
modules
props, instead of keep creating a new instance during each render.Before:
After:
Had the same problem and fixed it by not using the ‘value’ prop on the editor, but rather the ‘defaultValue’, which is apparently unmanaged to some extent. Using ‘react-quill’, fyi. Hope it helps.