Search code examples
javascriptquill

How to manually trigger a built-in action in QuillJS?


I am using QuillJS v2.0.0-dev.4 and I am trying to condense the toolbar. In other words, I would like to group several default actions under one dropdown. Here is the screenshot of what I am trying to achieve.

enter image description here

When an option is selected in the dropdown, this custom method gets called

Dropdown.onSelect = (label, value, quill) => {
    switch(true){
        case /^h1$/.test(value):  
                    //some code needed
                 break;
        case /^h2$/.test(value):  break;
        case /^h5$/.test(value):  break;
    }
};

Does anyone know how to trigger the default H1 action?


Solution

  • Just in case someone else needs this, here is the anwer

    quill.format('header','h1');