Jump to content

Adding new formats to the dropdown in TinyMCE


landitus
 Share

Recommended Posts

I was wondering if it's possible to add new formats to TinyMCE via the field's configuration. I'm trying to add a new format in the format's dropdown (the one with h2, blockquote, etc). I think it's possible natively with this setting: http://www.tinymce.com/wiki.php/Configuration:style_formats or this one: http://www.tinymce.com/wiki.php/Configuration:formats. This way, I can mark some text with the "note" format and it will render a paragraph with a class of "note", for example.

Take a look at this example: http://www.tinymce.com/tryit/custom_formats.php

Link to comment
Share on other sites

Not really, but thanks @kongondo. 

I've tried the default example for theme_advanced_styles and it didn't have any effect. Check out this screenshot of my settings. I guess it's not the same setting as described in the TinyMCE docs. Anyhow, I can't get any new element to show up in the format's dropdown. 

post-72-0-07924100-1390942336_thumb.png

post-72-0-77554400-1390942417_thumb.png

Link to comment
Share on other sites

  • 2 weeks later...

Thanks statestreet! Actually, what I'm looking for is to avoid adding another select, because I want to avoid confusions with the users. It looks from the example taken from TinyMCE that new "style formats" can be added to the Format's select. Take a look at the screenshot attached.

It would be better to just have one select for styling, in my case. Let me know if you can accomplish this! 

post-72-0-54207900-1391731536_thumb.png

Link to comment
Share on other sites

I agree, it's usually better to have just one select. I presume the Style select is for spans, while the regular select is for block-level, but I'd imagine in both our use cases, block-level is all content editors will need.

It appears this is accomplished through theme_advanced_blockformats. I added 'div' in there and that made 'DIV' appear in the dropdown, but I'm not sure how to apply classes to it yet.

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...