react-quill: Inserting Text into the editor with a custom button results in error on keystroke
Quill version
- master
Given a toolbar witha custom handler in the modules
function
toolbar: {
container: [
['custom']
],
handlers: {
"custom": function () {
this.quill.insertText(this.quill.getSelection().index, 'Hello', 'link', 'https://world.com');
console.log(this.quill.getText())
}
}
}
When you click the button it does correctly insert the text, but when you click in the editor you get:
The given range isn't in document.
Every time you try to type normally. Removing the item in the toolbar makes this stop
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 2
- Comments: 17
Use componentDidMount and ref, and remove handlers from modules:
in my case , it worked when i delete this from[ codepen example] (https://codepen.io/alexkrolick/pen/gmroPj?editors=0010) and added componentDidMount like @undermuz comment
my complete code ( using server render)