[英]Quill JavaScript Rich Text Editor restrict tags
我正在尝试使用 Quill JavaScript Rich Text Editor。 我需要将其配置为仅使用预定义的标签集:
b, i, pre, a, br + Emoji
现在我已经按以下方式配置了它:
var Block = Quill.import('blots/block');
Block.tagName = 'PRE';
Quill.register(Block, true);
var quill = new Quill('#editor-container', {
modules: {
toolbar: true
},
theme: 'snow'
});
如您所见,我已经将包装器更改为PRE
标记。 如何配置 Quill 以使用上述受限标签集? 不允许有其他标签,如果存在,必须自动删除。
在构造函数的参数中定义formats
,在那里你可以定义你想要支持的格式。
var quill = new Quill('#editor-container', {
formats: ['bold', 'italic', 'code', 'code-block', 'link'],
...
});
以下是所有格式的列表:
formats = [
// 'background',
'bold',
// 'color',
// 'font',
// 'code',
'italic',
// 'link',
// 'size',
// 'strike',
// 'script',
'underline',
// 'blockquote',
// 'header',
// 'indent',
'list',
// 'align',
// 'direction',
// 'code-block',
// 'formula'
// 'image'
// 'video'
];
您可以使用它来防止某些格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.