Tip: additional TinyMCE configuration in Umbraco 3, including valid_child_elements Options
Arjandb
Posted: Monday, September 01, 2008 4:09:39 PM
Rank: Devotee

Joined: 8/31/2007
Posts: 50
Location: Utrecht NL
As you may know, you can edit config/tinyMceConfig.config to modify some TinyMCE settings: commands, plugins, validElements (allowed html tags) and InvalidElements, but that's it.

Other options can't be set in Umbraco, but TinyMCE has a lot more options.

But you can use a little hack to set other options as well:
before the last two ]] brackets of the validElements CDATA section you can insert:

Quote:
", valid_child_elements :

"p/div/td[%itrans|#text]


and after that comes:

Quote:
]]></validElements>


Mind the positioning of opening and closing quotes and brackets.

This makes Umbraco think you just modify the validElements option, but TinyMce will see it as a seperate configuration element (or more). Have a look at the html source of umbraco/editContent.aspx to see what it does.

You can use linebreaks within the element as much as you want to keep things clear.

The above example sets the valid_child_elements option that makes output html code more xhtml compliant (no nested p or div tags allowed).

You can however use this hack to set any other configration option listed on http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
(as long as the option is ailable in TinyMC version 2, which is not the newest version).

Umbraco v4 will use TinyMce 3 and will hopefully have more elegant and standard ways of configuring TinyMCE.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.