Can anyone share where the options are stored for the alignment properties in tinyMCE?
By default if i use alignment right - float:right is added to the style for my element. I'd like to add default margin's to this.
i'm aware this can be achieved by adding style sheets, but i'd like to customize the alignment options.
Comments
Comment #1
twodThe defaults for these formatting buttons are set in TinyMCE's internals and look like this:
You can override it via Wysiwyg module's settings hook:
This example will make TinyMCE set a class to the listed element instead of adding a float style inline. Then can easily add the default margins/styling for those classes to your main theme file. Then will still be possible to override margins etc for specific parts of the content and you can change the default styling without having to modify the nodes.
Of course, you could also make it add the margins inline, and/or keep the float/textAlign:left/right; etc inline too. Less flexible at the time you decide to change the overall design, but a possible workaround if you for some reason can't change the stylesheets.
Just note that the second example has each
'selector' => ...part in its own array, which it needs to be if you want to apply different styling depending on which element is selected when the button is clicked.Comment #3
hixster commentedTwo D, thanks for the excellent explanation and help, apologies for the delay in replying, been super busy on a project.
Many thanks.
Comment #4
Chris Graham commentedI can't seem to get this to work for some reason. I'm running TinyMCE 3.2.7 and have a module set up to hook into wysiwyg called wysiwyg_mods (very original, I know) with the following:
If I uncomment that highlight_string() line the settings are being updated and if I check the source of the page the Drupal JS settings are showing the formats being output correctly:
I've cleared the Drupal caches, cleared my browser cache and the alignment buttons are all still only adding floats and text-aligns instead of the classes. I've tried this on both a live site and on my sandbox site with a fresh install of D6.17 + Wysiwyg + TinyMCE 3.2.7 and it still didn't work.
Anyone got any ideas why it wouldn't work?