Alter default InitOptions for TinyMCE in Episerver 6
The default config options set by CreateDefaultInitOptions() aren't really what you need to help editors create correctly marked up content. Luckily the people at Episerver have a way to tweak 'em.
You just need to add a class and decorate it with some plugin magic. Here's a proof of concept of how to go about it:
namespace Krompaco.Plugins
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using EPiServer;
  using EPiServer.Editor.TinyMCE;
  [TinyMCEPluginNonVisualAttribute(
      AlwaysEnabled = true,
      PlugInName = "OptimizedEditor",
      DisplayName = "Custom editor init options",
      Description = "Loads custom editor init options.",
      EditorInitConfigurationOptions = @"{
        paste_auto_cleanup_on_paste : true,
        valid_elements : ""a[href],strong/b,em/i,br,ul,ol,li,-h2,-h3,-h4,-h5,-h6,-p"",
        theme_advanced_blockformats : ""h2,h3,h4,h5,h6,p"",
        theme_advanced_resizing : false,
        body_class : ""module-text""
      }"
  )]
  public class OptimizedEditor
  {
  }
}
Code is tested using Episerver CMS 6 R1 and 6 R2.
Published and tagged with these categories: Episerver, ASP.NET, TinyMCE