When I create custom blocks, no matter what tag name I use, I get the following error when doing things like undo and toggling formats:
quill.js:7166 Uncaught TypeError: Cannot read property 'mutations' of undefined
Steps for Reproduction
foo.bar.Expected behavior:
No mutation errors and the undo history remains intact.
Actual behavior:
Mutation error occurs and it seems like the undo history is often messed up once the error happens.
Platforms:
Chrome 69.0.3497.92 on macOS High Sierra.
Version:
1.3.6
@Ravenstine After having a look into the sources I found a dirty workaround that fixes the issue for me: I'm manually adding the new blot name of the inline element to the Inline.order array.
Inline.order.splice(Inline.order.indexOf('bold'), 0, 'foo');
see: https://github.com/quilljs/quill/blob/develop/blots/inline.js#L49-L59
@Ravenstine try to add additional condition into if statement blot.domNode[Registry.DATA_KEY] &&
if (blot.domNode[Registry.DATA_KEY] && blot.domNode[Registry.DATA_KEY].mutations == null) {
// @ts-ignore
blot.domNode[Registry.DATA_KEY].mutations = [];
}
I just had the same issue. It will be good to have a solution from the quill side.
@toao thanks for the workaround. It did the job for me.
Most helpful comment
@Ravenstine After having a look into the sources I found a dirty workaround that fixes the issue for me: I'm manually adding the new blot name of the inline element to the
Inline.orderarray.see: https://github.com/quilljs/quill/blob/develop/blots/inline.js#L49-L59