react-quill
react-quill copied to clipboard
BUG: Overwriting binding of key tab
Hi,
I'm using version beta.4 with react version 17.0.2.
I'm trying to override the tab function as shown in the Quill docs, and as mentioned in lots of threads:
keyboard: { bindings: { // This will overwrite the default binding also named 'tab' tab: { key: 9, handler: function() { // Handle tab } }, } }
What happens is that if I press anything other than the key tab, the editor will break and disappear.
And then if I go around my app, it gives me this error:
TypeError: Cannot read properties of undefined (reading 'delta') ReactQuill.componentDidUpdate src/src/index.tsx:277 274 | // The component has been regenerated, so it must be re-instantiated, and 275 | // its content must be restored to the previous values from the snapshot. 276 | if (this.state.generation !== prevState.generation) {
277 | const {delta, selection} = this.regenerationSnapshot!; | ^ 278 | delete this.regenerationSnapshot; 279 | this.instantiateEditor(); 280 | const editor = this.editor!;
I've tried to debug, but couldn't find any answer as to why it happens.
Thanks
It seems the problem comes from the setState() inside the onChange function of ReactQuill component If I comment the setState, the editor works without any errors
I've got the exact same error (TypeError: Cannot read properties of undefined (reading 'delta')
), but not because of the same reason - I'm using the quill-mention plugin and when I change it's config value (from the modules prop), I get that error
Update:
Before I said that the editor without the setState worked seamlessly, but that's not true. It still is disappearing if I try to overwrite the "tab" function.
Any help here? I'm having the same issue and I don't know how to solve it :/
Same error here, anyone able to solve it?