Search code examples
aloha-editor

In the Aloha editor, how do you limit the types of headings available in the formatting toolbar?


Let's say you want to just allow h3, h4, h5, and h6 in the Aloha toolbar, and not show h1, h2, h3. What is the setting to do this?


Solution

  • Aloha.settings.plugins.format = {
    // configure buttons available in the toolbar
    // this example enables all buttons available
    config : [ 'strong', 'em', 'b', 'i', 'del', 'sub', 'sup', 'p', 'h4', 'h5', 'h6', 'pre', 'removeFormat'],
    // specific configuration for each editable identified by css selectors
    editables : {
        // the editable with id "teaser" won't offer any formatting options
        '#teaser'   : [  ]
    },
    // those are the tags that will be cleaned when clicking "remove formatting"
    // this example resembles the default configuration
    removeFormats : [ 'strong', 'em', 'b', 'i', 's', 'cite', 'q', 'code', 'abbr', 'del', 'sub', 'sup']
    

    };

    https://github.com/alohaeditor/Aloha-Editor/issues/931#issuecomment-18775515