在羽毛笔编辑器中更改标签?

时间:2015-05-08 12:48:48

标签: javascript rich-text-editor quill

我试着查看文档,但没有解释为什么我可以更改粗体格式以在<strong>text</strong>标记而不是<b>text</b>标记之间换行文字?

var options = {
    modules: {
        placeholder: { text: attrs.rtePlaceholder, style: { color: '#A9A9A9' } }
    }
};
var quil = new Quill('#' + element.attr('id'), options);
var Normalizer = Quill.require('normalizer');
delete Normalizer.ALIASES["STRONG"];
Normalizer.ALIASES["B"] = "STRONG";
quil.addFormat('bold', { tag: 'STRONG', prepare: 'bold' });

1 个答案:

答案 0 :(得分:2)

官方支持仍在进行中,但现在应该可行:

var Normalizer = Quill.require('normalizer');
delete Normalizer.ALIASES["STRONG"];
Normalizer.ALIASES["B"] = "STRONG";
quill.addFormat('bold', { tag: 'STRONG', prepare: 'bold' });