[Parchment] Unable to create mention blot
See original GitHub issueI use this module in Quill but error me:
[Parchment] Unable to create mention blot
I used this:
import mention from 'quill-mention';
Quill.register({
'modules/mention': mention,
});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
[Parchment] Unable to create mention blot · Issue #76 - GitHub
I use this module in Quill but error me: [Parchment] Unable to create mention blot I used this: import mention from 'quill-mention'; ...
Read more >angular 5 and quilljs [Parchment] Unable to create blot
I was apple to fix my problem with next approach ... declare var Quill: any; const BlockEmbed = Quill.import('blots/embed'); export class ...
Read more >Quill/Parchment error: Unable to create list-item blot - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >Getting to know QuillJS - Part 1 (Parchment, Blots, and Lifecycle)
When creating a Blot with Parchment.create(blotName) and passing in a sting corresponding to a register blotName , you will always get the ...
Read more >[Parchment] Unable to create image blot - Bountysource
I'm trying to insert image: import Quill from 'quill/core'; import Toolbar from 'quill/modules/toolbar'; import Snow from ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This problem is still around. I figured out what goes wrong in my case…
The
quill-mention
lib tries to importQuill
viaimport Quill from "quill"
(https://github.com/afry/quill-mention/blob/master/src/quill.mention.js#L1)But if you’re using
import Quill from 'quill/dist/quill.core'
in your app, that’s where it fails.So this issue is actually rather similar to https://github.com/afry/quill-mention/issues/77
My quick and dirty fix is essentially to do a core-only build of this package, but that’s obviously not ideal.
I would like to offer a suggestion on how to fix this – perhaps don’t self-register with
Quill
on import and let the developer runQuill.register
themselves?You could potentially export the blot and the module separately and allow the developer to do something like:
This would be a breaking API change for the package, but something to consider. Also possible to export a constructing function that takes
Quill
as an argument:@NakedFool I actually ended up doing what @jurgen-reconcept suggests in that thread and clone the package, run
npm run build
, copy the files in./dist
into your own project and use that. This way, you force the plugin to use the version of Quill you’re using, in your case 2.0.0.TLDR; explanation:
See, when you create a plugin you need to register it, by running
Quill.register(MyPlugin)
. This is well documented and all but a lot of plugins (like the Emoji one as well) runQuill.register()
for you inside their own module.They do this cause then there’s less boilerplate code for devs wanting to use their plugins, but the downside is that they need to import Quill themselves into their module in order to run its static method. So in this module’s dependencies you’ll find
quill@1.3.x
andnpm
resolves this as its own version of Quill, meaning your code runsquill@2.0.0
and this plugin has a different version,quill@1.3.7
. Here’s where this goes wrong.The problem I was having was actually not with 2.0.0 as much as using the
quill/core
version of Quill. the solution is very similar. Clone the repo, go intosrc/quill.mention.js
andsrc/blots/mention.js
and edit theimport Quill from 'quill'
toimport Quill from 'quill/core'
. Do your own build. Copy files from./dist
and viola.