“BlotClass.create is not a function” when trying t

2019-08-30 17:49发布

问题:

I'm trying to create a custom style attributor in Quill to use inline styles for indentation. All I have so far is the bare minimum:

class Indent extends Parchment.Attributor.Style {}

const IndentStyle = new Indent('indent', 'margin-left', {
  scope: Parchment.Scope.BLOCK
});
Quill.register(IndentStyle, true);

However, when I try to apply the indent formatting via a toolbar button, I get this error in the console:

ERROR TypeError: BlotClass.create is not a function
    at Object.create (quill.js:184)
    at Block.ShadowBlot.replaceWith (quill.js:5200)
    at Block.FormatBlot.replaceWith (quill.js:3610)
    at Block.FormatBlot.format (quill.js:3597)
    at BlockBlot.format (quill.js:7250)
    at eval (quill.js:2513)
    at Array.forEach (<anonymous>)
    at eval (quill.js:2510)
    at Array.forEach (<anonymous>)
    at Editor.formatLine (quill.js:2506)

Any idea what I am doing wrong here?