views:

27

answers:

2

Does anyone know how I can enable text alignment of header tags through the TinyMCE interface? If I select the text (of any header tag) and select an aligment option it appears to have lined up correctly in the editor. However, when I save the page it gets shifted back to the default alignment (in my case left).

I have also tried editing the HTML directly but when I close the dialog the HTML doesn't seem to update.

I found some documentation on the wiki about the extended_valid_elements which I tried to update in the tiny_mce.js file but it didn't seem to make a difference.

Here is the `valid_elements' setting for the header tags from the tinyMceConfig.config file:

-h1[id|dir|class|align],-h2[id|dir|class|align], -h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|style|dir|class|align]

+1  A: 

What about valid_elements? I think this should be the right setting for you, because header tags are valid xhtml tags, you do not need extended_valid_elements.

Thariama
Hi, I checked the valid elements and it appears to be configured correctly, see my question I have posted the configuration from the tinyMceConfig file.
James
is this behaviour to be seen on one of the examples pages from moviecode(http://tinymce.moxiecode.com/examples/full.php)?
Thariama
No it works fine in the example pages
James
hmm, could you please post your full configuration?
Thariama
I managed to figure out what the problem was. I installed a local version of umbraco 4 and ran it straight out of the box. Same issue, I looked at the configuration in the tinyMceConfig.config file and noticed that the `align` attribute was enabled for the header tags....but when you select the align options in the editor it trys to set the `style` attribute not the align! So I updated the config file to allow the style attribute for the tags and hey presto it worked. Tried the same changes on my live site but it never seems to update, any idea's?
James
I have already restarted umbraco 3-4 times and even deleted history etc to make sure it wasn't a cache problem.
James
glad you found the solution yourself
Thariama
Yeah, been an absolute pain in the @ss! I managed to fix the issue on the live server aswell, I had to recycle the app pool.
James
+1 for your help as eventually I narrowed the problem down to being related to the valid_elements, just had to use the process of elimination!
James
+1  A: 

Just for anyone who has a similar issue, I managed to resolve this.

The editor attempts to apply the style attribute to header tags when you select any of the alignment options, by default this is not enabled in the valid_elements configuration.

In order to get this to work you just need to add the style attribute to the configuration for each header e.g. -h1[id|dir|class|align|style], -h2[id|dir|class|align|style] etc

If using Umbraco you need to make these changes in the ~/config/tinyMceConfig.config file and then recycle the app pool your site is running under.

James
+1 for presenting own solution
Thariama