SaaS CMS has officially launched! Learn more now.

TinyMce Style Formats



"EPiServer.CMS" version="11.15.0"

"EPiServer.CMS.TinyMce" version="2.10.1"

I am currently trying to add a custom format to our tinymce, if I use the normal process of

            context.Services.Configure<TinyMceConfiguration>(config =>
                config.Default().StyleFormats(new {});

The this overwrites all other formats.

So I went down this route...

                var simpleConfig = config.Default().Clone();
                var defaultFormats = simpleConfig["style_formats"] as object[];
                var newFormats = defaultFormats.Append(new { title = "Quote Footer", block = "footer" });
                simpleConfig["style_formats"] = newFormats;
                config.For<RichTextBlock>(t => t.Content, simpleConfig);

The problem with this is I get the error:

The given key was not present in the dictionary

Which looking at the tiny documentation I found very odd, delving into my "simpleConfig" it has 12 properties, none of which are "style_formats"

Am I missing something here, because imo I would have expected "style_formats" to be present.

Do note that this solution used to be tinymce v1 but was upgraded to v2 a while back.

TLDR; Trying to add a custom style while keeping current styles and style_format doesn't exist

Jul 14, 2020 18:33
* 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.