I'm using react-quill library, the editor is working fine, I added undo redo buttons to the editor and still working fine, but when I passed props {onChange, defaultValue} , I get this warning:
addRange(): The given range isn't in document.
whenever I type in the editor the editor disappear from the page and the console gives the above warning.
Live Preview of the issue:
https://codesandbox.io/s/weathered-framework-m5hk0u?file=/src/NewPost.jsx
Please Check TextEditor.jsx
I think the error is from here
const undoHandler = () => {
reactQuillRef.current.editor.history.undo("undo");
};
const redoHandler = () => {
reactQuillRef.current.editor.history.redo("redo");
};
What I think what makes the error is current.editor
, and the question is how to fix it? how to set content
to the editor? Some help would be appreciated.