BentoumiTech
BentoumiTech

Reputation: 1683

Change tags in quill editor?

I tried to look in the documentation but nothing explain how for example I could change the bold format to wrap text between <strong>text</strong> tag instead of <b>text</b> tag ?

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' });

Upvotes: 1

Views: 2434

Answers (1)

jhchen
jhchen

Reputation: 14757

Official support is still forthcoming but this should work for now:

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

Upvotes: 2

Related Questions