Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'mutations' of undefined #87

Open
antonioribeiro opened this issue Jun 26, 2020 · 7 comments
Open

TypeError: Cannot read property 'mutations' of undefined #87

antonioribeiro opened this issue Jun 26, 2020 · 7 comments

Comments

@antonioribeiro
Copy link

I believe we have traces of this problem happening in a lot of places, and it should be kind of easy to fix, but maybe not really to understand:

#14
slab/quill#2312
area17/twill#458
slab/quill#889

This error is occurring in Quill when the list of nodes are, somehow, problematic.

This is a simple console.log() of blot.domNode:

image

As you can see the error occurs while processing a <br>, on line 121:

image

Because that line is compiled to

if (blot.domNode[Registry.DATA_KEY].mutations == null) ...

But it could be prevented by just:

if (blot.domNode[Registry.DATA_KEY] && blot.domNode[Registry.DATA_KEY].mutations == null) ...

Because what happens is that this particular node doesn't exists, so a mutation property is, of course, undefined.

phorvicheka added a commit to Yonsei-Maist/cdm-recommender-api-server that referenced this issue Nov 3, 2020
…ist\quill.js adding "blot.domNode[Registry.DATA_KEY] &&" to if condition on line 7239 to prevent error of TypeError: Cannot read property 'mutations' of undefined

Ref:
slab/parchment#87
@monkeyphysics
Copy link

Is there any hotfix available?
It's hard to apply the change to the minified Quill code, and don't want to run unminified in production.

@ackmanx
Copy link

ackmanx commented Jul 6, 2021

Although using that guard prevents Quill from crashing in this instance, I also noticed that it clears out the toolbar of selected formats and then when I try and delete any text I get a new error... 'leaf.position is not a function'.

@ackmanx
Copy link

ackmanx commented Jul 6, 2021

This is my barebones example demonstrating the problem: https://codepen.io/ackmanx/pen/xxqzPyy?editors=1111

@nghuuphuoc
Copy link

I got the same issue. Subscribe to this!

@parthibanloganathan
Copy link

Same issue

@wangziweng7890
Copy link

same issue

@uniquejava
Copy link

Same here, I hacked some Shift+Enter to insert LineBreak <br> tag(Not Easy but worked) and then new problem is coming, that is undo(Command+Z) throws me this Mutation Error, what a journey!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants