Question

By default, under the Formatting menu (when the button is clicked), there are these options:

Normal Text
Quote
Code 
Header 1
Header ...
Header 5

I would like to only have these options:

Normal Text
Quote
Code

Is there any way to do that? I've been scouring the configuration options and haven't been able to find out how to do it.

Was it helpful?

Solution

Olivérs answer is wrong.

You can easily achieve this by doing the following:

$('#redactor').redactor({
    formattingTags: ['p', 'blockquote', 'pre']
});

Demo: http://jsfiddle.net/EkM4A/

OTHER TIPS

Sadly the only way to achieve this is to decorate your redactor instance before init and overwrite the default toolbar setting in redactor.

You can see a working POC here: http://jsfiddle.net/Zmetser/7m3f9/

And the code below:

$(function() {
    // Decorate redactor Object before init
    $.Redactor.fn = (function () {
        var toolbarInitOriginal = this.toolbarInit;
        // Create a new toolbarInit method which suits our needs
        this.toolbarInit = function (lang) {
            // Grab the default toolbar...
            var toolbar = toolbarInitOriginal(lang);
            // ...and overwrite the formatting dropdown menu
            toolbar.formatting.dropdown = {
                p: {
                    title: lang.paragraph,
                    func: 'formatBlocks'
                },
                blockquote: {
                    title: lang.quote,
                    func: 'formatQuote',
                    className: 'redactor_format_blockquote'
                },
                pre: {
                    title: lang.code,
                    func: 'formatBlocks',
                    className: 'redactor_format_pre'
                },
            };

            return toolbar;
        };

        return this;
    }.call($.Redactor.fn));

    // Init redactor
    $('#redactor').redactor({
        buttons: ['link', 'formatting', 'html']
    });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top