volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

TinyMCE removes custom attributes

Hello,

I'm trying to add the HTML 5 sandbox attributes to an iFrame in the TinyMCE editor, except everytime I update, it removes the attributes. I've read how you can get round this in Episerver 6 but when this workaround http://www.frederikvig.com/2010/10/how-to-add-support-for-iframes-and-other-elements-to-tinymce-in-episerver-cms/ is applied it tends to break the editor in Episerver 7.5. Can anyone provide any help on how to resolve this issue.

Many Thanks

Paul

#86050
May 13, 2014 9:11
Vote:

After much searching I've discovered the answer. I found this blog entry by Chris Sharp who explained why this doesn't work in Episerver 7 and how to get round it. http://cjsharp.com/blog/2013/04/15/how-to-add-valid-elements-like-iframes-to-tinymce-in-episerver-7/

Here's the code in case the link doesn't work in the future:-

Extended Valid Elements Code

[TinyMCEPluginNonVisual(PlugInName = "TinyMceExtendedValidElements", AlwaysEnabled = true, EditorInitConfigurationOptions = "{ extended_valid_elements: 'iframe[src|frameborder=0|alt|title|width|height|align|name]' }")]
public class TinyMceExtendedValidElements
{
}

Empty File Handler (for when the script is missing)

public class EmptyFileHandler : IHttpHandler
{
    public bool IsReusable
    {
        get { return true; }
    }

    public void ProcessRequest(HttpContext context)
    {
    }
}

    

Web.Config update

<configuration>
    ... some configuration ... 
    <location path="util/editor/tinymce/plugins">
        <system.webServer>
            <handlers>
                <add name="TinyMceExtendedValidElements" path="/util/editor/tinymce/plugins/TinyMceExtendedValidElements/editor_plugin.js" verb="GET" type="MyEPiServerProject.Business.Handlers.EmptyFileHandler, MyEPiServerProject" />
            </handlers>
        </system.webServer>
    </location>
</configuration>

    

Episerver.Config update

<episerver>
... some configuration ...
<tinyMCE mergedConfigurationProperties="valid_elements, extended_valid_elements, invalid_elements, valid_child_elements" />
</episerver>

    

#86055
Edited, May 13, 2014 10:50
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.