How to add support for iframes (and other elements) to TinyMCE in EPiServer CMS

Posted on October 18, 2010 by Frederik Vig in EPiServer

One of my clients had some problems adding an iframe inside the TinyMCE editor that ships with EPiServer CMS. After looking a little at the documentation I saw that the default was not to allow iframes.

Here’s a list of the default valid elements of TinyMCE: TinyMCE:Configuration/valid elements.

The fix turned out to be fairly simple. All I needed to do was add the iframe element to the valid elements of the TinyMCE editor (along with the attributes).

using EPiServer.Editor.TinyMCE;
namespace Customer.Web.Templates.Plugins.TinyMCE
    [TinyMCEPluginNonVisual(AlwaysEnabled = true, EditorInitConfigurationOptions = "{ extended_valid_elements: 'iframe[src|frameborder=0|alt|title|width|height|align|name]' }")]
    public class ExtendedValidElements

And in my episerver.config file.

<tinyMCE mergedConfigurationProperties="valid_elements, extended_valid_elements, invalid_elements, valid_child_elements" />

More on EPiServer CMS and TinyMCE: TinyMCE Developers Guide.

Related Posts: