Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Allow valid HTML elements to TinyMCE 2.+ in Episerver 11
using System.Collections.Generic;
using EPiServer.Cms.TinyMce.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
namespace MySite.Business.Initialization
public class ExtendedTinyMceInitialization : IConfigurableModule
public void Initialize(InitializationEngine context)
public void ConfigureContainer(ServiceConfigurationContext context)
var customSettings = new Dictionary<string, object>
"section[*],&[*],i[*],div[*],a[*],span[*],script[*],style[*],iframe[*],container[*], h3[*]"
"+a[img|h1|h2|h3|h4|h5|h6|p|span|div|i|noscript], +span[a|h1|h2|h3|h4|h5|h6|p|span|i|div|noscript], +div[a|h1|h2|h3|h4|h5|h6|p|span|i|div|noscript]"
context.Services.Configure<TinyMceConfiguration>(config =>
.Menubar("file edit insert view format table tools")
"epi-link epi-image-editor epi-dnd-processor epi-personalized-content print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template code table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern help")
"epi-link | epi-image-editor | epi-personalized-content | cut copy paste | fullscreen",
"styleselect formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | table | image epi-image-editor media code | epi-dnd-processor")
public void Uninitialize(InitializationEngine context)

This comment has been minimized.

Copy link
Owner Author

@javafun javafun commented Jul 8, 2021

.AddSetting("valid_children", "a[div|p|h1|h2|h3|h4|h5|h6|ul|ol|li|strong|em|i|img|span]")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment