Krompaco

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 guys 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:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EPiServer;
using EPiServer.Editor.TinyMCE;

namespace Krompaco.Plugins
{
  [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
  {
  }
}

Categories: TinyMCE, EPiServer, Development

Last update Thursday 20 May 2010 16:15
RSS for comments to this page Trackback URL

Comments

Add Your Comment

Pages

Feeds & Copyright