I have a situation where sometimes a block of paragraph texts or one single image needs to be wrapped in a special div. I am trying to figure out a way to do it without having to edit the HTML which would be it as simple as 'Toggle Editor' and manually add a wrap the required tag(s).
The only way I sort of managed to achieve it was by adding the following in the Default Editor's (TinyMCE) tinymce.init function in the extended part:
style_formats : [
{title : 'Wrapper container', block : 'div', classes : 'wrap-div', wrapper : true}
],
Now this shows a new style in the editor (Format -> Formats -> Wrapper Container) and when I apply it, it works fine but this method requires me to edit a core file and I was wondering if there was a better solution to this? Thanks.