After using Quill 1.3.7 successfully with custom embed blots, we decided to upgrade to 2.0.0-dev3 for new features. However, this upgrade caused our custom blots to break, resulting in the error message:
Class constructor BlockEmbed cannot be invoked without 'new'
We attempted various solutions such as:
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 ...
All of these attempts led to the same error mentioned above.
We also tried utilizing Parchment directly but faced different errors like Parchment being undefined:
import Parchment from "parchment";
class PageBreak extends Parchment.Embed ...
class PageBreak extends Parchment.EmbedBlot ...
Our implementation involves using the Quill.insertEmbed() function, and we even experimented with creating a Delta and updating the document.
If you want to see an example with our custom PageBreak blot, check out this link: https://codesandbox.io/s/vibrant-flower-8kuy2?file=/src/PageBreak.ts
It's worth noting that we are targeting es5.