“BlotClass.create is not a function” when trying to create a custom attributor in Quill

空扰寡人 提交于 2019-12-13 03:38:39

问题


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?

来源:https://stackoverflow.com/questions/48373448/blotclass-create-is-not-a-function-when-trying-to-create-a-custom-attributor-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!