Unable to create custom BlockEmbed using Quill 2.0-dev3

270 Views Asked by At

We have been using Quill 1.3.7 for a while. I had some custom embed blots written that were working without issue. We then upgraded to 2.0.0-dev3 to gain new functionality and this has broken our custom blots. I receive the following error when I select the option in the toolbar:

Class constructor BlockEmbed cannot be invoked without 'new'

Here's some of what I've tried:

import Quill from "quill";

class PageBreak extends Quill.import("blots/block/embed") ...
class PageBreak extends Quill.import("blots/embed") ...
class PageBreak extends Quill.import("parchment").EmbedBlot ...
class PageBreak extends Quill.import("parchment").Embed ...

These all resulted in the above listed error.

Additionally, I've gone down the route of using Parchment directly with different errors (usually Parchment being undefined):

import Parchment from "parchment";

class PageBreak extends Parchment.Embed ...
class PageBreak extends Parchment.EmbedBlot ...

I'm using the Quill.insertEmbed() function to accomplish this. I've also attempted creating a Delta and updating the document.

An example with our custom PageBreak blot can be found here: https://codesandbox.io/s/vibrant-flower-8kuy2?file=/src/PageBreak.ts

We are targeting es5.

0

There are 0 best solutions below