Building a bit on the answer of this question, I would like to know if it's possible to add more buttons to the editor after it is loaded/constructed. I have one custom button like this:
var Block = Quill.import('blots/block');
class MyThing extends Block {}
MyThing.blotName = 'my-thing';
MyThing.className = 'my-thing';
MyThing.tagName = 'div';
Quill.register(MyThing);
var quill = new Quill('#editor', {
theme: 'snow',
modules: {
toolbar: [
['my-thing']
]
}
});
The user should be able to add their own buttons into this editor. There's a separate textfield somewhere, where they can write down the name of the button and then have it added as a new button to the editor after submitting it.
Is that possible? I want to be able to do something similair to this (doesn't work, obviously):
var newButton = $('#newButtonName').val();
var Block = Quill.import('blots/block');
class NewButton extends Block {}
NewButton.blotName = newButton;
NewButton.className = newButton;
NewButton.tagName = 'div';
Quill.register(NewButton);
quill.modules.toolbar.push(newButton);