@orpha
To create custom format buttons in Quill.js, you can follow these steps:
1 2 3 4 5 6 7 8 9 10 |
var toolbarOptions = [ [{ 'header': [1, 2, 3, 4, false] }], ['bold', 'italic', 'underline', 'strike'], // toggled buttons ['link', 'image'], ['code-block'], [{'list': 'ordered'}, {'list': 'bullet'}], [{'align': []}], ['clean'], // remove formatting button [{'format-custom': 'custom'}] // custom format button ]; |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Quill.register('formats/custom', { class CustomFormat extends Quill.import('blots/inline') { static blotName = 'custom'; static tagName = 'span'; static className = 'custom'; } }); Quill.register('formats/formatCustom', FormatCustom, true); const CustomButton = Quill.import('ui/formats/button'); CustomButton.className = 'ql-custom'; CustomButton.value = 'custom'; |
1 2 3 4 5 6 7 8 |
var quill = new Quill('#editor', { modules: { toolbar: { container: toolbarOptions, } }, theme: 'snow' }); |
With these steps, you should be able to create your own custom format buttons in Quill.js and apply custom formatting to your text.