TinyMCE Multiple classes to an element?
Permalink
I have a need to be able to add two classes to an <a> tag in the editor. I know I can view it in HTML and add it myself, but want an easy way for the client to do it.
I have various styles (eg: .img-right, .img-left) set up in typography.css which works beautifully, but I can't see a way of applying 2 classes, for example if using bootstrap, you may want to add the classes "btn btn-mini".
I successfully managed this by adding it to a custom toolbar set:
...but this seems to override the styles in typography.css although it will still show the correct formatting for headings and text etc.
Any idea's how to overcome this?
I have various styles (eg: .img-right, .img-left) set up in typography.css which works beautifully, but I can't see a way of applying 2 classes, for example if using bootstrap, you may want to add the classes "btn btn-mini".
I successfully managed this by adding it to a custom toolbar set:
style_formats : [ {title:"PDF Button", selector:"a", classes:"btn btn-mini"}, ],
...but this seems to override the styles in typography.css although it will still show the correct formatting for headings and text etc.
Any idea's how to overcome this?
When I say override, I mean it removes all the styles from the dropdown that were there from my typography.css and just shows the one style (btn btn-mini) added in the custom toolbar set.
OK, then, after thinking overnight (it was a long day yesterday), because it still loads the typograpy.css styles they are still useable, so in essence all you have to do is add the missing class names to the "style_formats" part of the custom toolbar set so you can apply the class to the element.