本文介绍了在 QuillJS 中创建自定义类属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 QuillJS 中创建自定义类属性.我已经走了这么远:
let config = {范围:Parchment.Scope.BLOCK,};let MClass = new Parchment.Attributor.Class('mark', 'dom-mark', config);Quill.register(MClass,true)
但是尝试时:
this.quillEditor.format('mark', 'MarkThisHere');
我明白了:
错误类型错误:BlotClass.create 不是函数
我做错了什么?
解决方案
在这个示例中对我有用
一>.
Parchment = Quill.import('parchment');让配置 = {范围:Parchment.Scope.BLOCK,};let MClass = new Parchment.Attributor.Class('mark', 'dom-mark', config);Quill.register(MClass,true)var quill = new Quill('#editor-container', {模块:{工具栏:[[{ 标题:[1, 2, 假] }],['粗体','斜体','下划线'],['图像','代码块']]},placeholder: '撰写史诗...',主题:雪"//或泡泡"});quill.format('mark', 'MarkThisHere');
I'm trying to create a custom class attributer in QuillJS.I've got this far:
let config = {
scope: Parchment.Scope.BLOCK,
};
let MClass = new Parchment.Attributor.Class('mark', 'dom-mark', config);
Quill.register(MClass,true)
But when attempting:
this.quillEditor.format('mark', 'MarkThisHere');
I get:
ERROR TypeError: BlotClass.create is not a function
What am i doing wrong?
解决方案
Works for me in this example.
Parchment = Quill.import('parchment');
let config = {
scope: Parchment.Scope.BLOCK,
};
let MClass = new Parchment.Attributor.Class('mark', 'dom-mark', config);
Quill.register(MClass,true)
var quill = new Quill('#editor-container', {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block']
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
});
quill.format('mark', 'MarkThisHere');
这篇关于在 QuillJS 中创建自定义类属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!