尝试使用特定格式初始化Quill并收到错误

时间:2015-09-24 06:11:16

标签: quill

我正在尝试根据格式API加载quill以仅支持某些格式:http://quilljs.com/docs/formats/

但每当我添加格式键时,我都会收到错误

TypeError: Cannot read property 'config' of undefined

这是初始化quill的代码。如果我注释掉格式键,它就可以了。

@editor = new Quill(@find('.quill-editor'),
      formats: ['bold']
      modules:
        placeholder:
          text: "Enter Text" 
          style:
            color: '#A9A9A9'
        'authorship':
          authorId: username
          enabled: true
        toolbar:
          container: @find('.quill-toolbar')
        "link-tooltip": true,
        #'placeholder': 'Enter Text'
        #'image-tooltip': true
      theme: "snow"
    )

可能有什么不对。为什么羽毛笔不喜欢格式键?

1 个答案:

答案 0 :(得分:2)

可能的罪魁祸首是占位符模块(不确定这是你的还是第三方)。删除它可以解决问题,formats配置的工作方式与宣传的一样:http://jsfiddle.net/b1s09v3n/

类似的问题是Github Issue。由于多人遇到这种情况,或许文档的某些部分不清楚?或者您都使用相同的第三方占位符模块。