Tuesday, May 31, 2011

IFrame in the new EPiServer CMS 6 editor

The new TinyMCE editor that comes with EPiServer CMS 6 and later has a list of default elements that are allowed which does not include the iframe-tag.


This means that editors cannot by default embed youtube-videos into their code through the editor (unless, of course, they actively choose the old embed code, which noone does) as it is automatically cleaned by the TinyMCE-editor.

To get around this you need to add the iframe to the list of valid elements by manually creating a class with the TinyMCEPluginNonVisual attribute and specifying EditorInitConfigurationOptions.

Refer to this excellent blogpost by Frederik Vig for more information.