Trumbowyg: Restrict formatting

Created on 10 Feb 2017  路  2Comments  路  Source: Alex-D/Trumbowyg

Hi

It's not an issue, but a feature idea/request (not sure if this is the right way, if not, please let me know).

I'd like to give the user the option to format a part of the text as paragraph and others as h2 or h3. h1 and blockquote should be forbidden however, as they fuck up the design.

I solved this the "hacky" way, by just removing them at t.btnsDef.formatting.dropdown. It would be great to have a proper way of doing this. Maybe the formatting options could be moved to t.o or be overwritten by stuff saved there.

Thanks (:

documentation

Most helpful comment

Tried it and it works like a charm. I'm using:

jQuery('textarea[wysiwyg]').trumbowyg({
    btns: ['customFormatting', '|', 'bold', '|', 'link', '|', 'unorderedList', 'orderedList'],
    btnsDef: {
        customFormatting: {
            dropdown: ['p', 'h2', 'h3', 'h4'],
            ico: 'p'
        }
    },
});

Maybe, you could add a tutorial on the documentation page.

Awesome work and feel free to close the issue, thanks (:

All 2 comments

Hey !

You should create your own formatting dropdown, not modifying the existing one. If you do that, it's not hacky :)

Check it out: https://github.com/Alex-D/Trumbowyg/blob/develop/index.html#L85

Tried it and it works like a charm. I'm using:

jQuery('textarea[wysiwyg]').trumbowyg({
    btns: ['customFormatting', '|', 'bold', '|', 'link', '|', 'unorderedList', 'orderedList'],
    btnsDef: {
        customFormatting: {
            dropdown: ['p', 'h2', 'h3', 'h4'],
            ico: 'p'
        }
    },
});

Maybe, you could add a tutorial on the documentation page.

Awesome work and feel free to close the issue, thanks (:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neerajjoshi picture neerajjoshi  路  4Comments

mgjunk picture mgjunk  路  4Comments

dohomi picture dohomi  路  5Comments

akupiec picture akupiec  路  4Comments

btecu picture btecu  路  3Comments