contentco / quill-emoji

Quill module toolbar extension for emoji
275 stars 165 forks source link

[Parchment] Cannot insert emojiBlot into block #146

Closed Protocteur closed 2 years ago

Protocteur commented 2 years ago

I got this error when i select an emoji to add in my content :

[Parchment] Cannot insert emojiBlot into block

I'm running this module with quill v1.3.7, and i saw the error come from parchment.js :

ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) { if (this.statics.allowedChildren != null && !this.statics.allowedChildren.some(function (child) { return childBlot instanceof child; })) { throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName); } childBlot.insertInto(this, refBlot); };

In this method, the childBlot (emojiBlot in that case) doesn't return true when the instance is compared to EmbedBlot (that came from allowedChildren)

So i think the issue came from by the way emojiBlot extend Embed (that came from quill, and not from Parchment like in quill core modules, like Image ..)

So ... i fixed the issue and the PR is coming soon ;)