Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.
Optimizely comes with a preconfigured TinyMCE editor that renders all XHTML properties by default.
The default configuration for TinyMCE uses the constants defined on the EPiServer.Cms.TinyMce.Core.DefaultValues class. For information about plugins, see Optimizely TinyMCE plugins.
The DefaultValues.EpiserverPlugins constant defines the default Optimizely plugins:
"epi-link epi-image-editor epi-dnd-processor epi-personalized-content"
Note: The epi-dnd-processor is a required plugin to drag and drop Optimizely content.
The DefaultValues.TinyMcePlugins constant defines the default TinyMCE plugins:
"help image fullscreen lists searchreplace"
The DefaultValues.Toolbar constant defines the default toolbar configuration:
"formatselect | bold italic | epi-link image epi-image-editor epi-personalized-content
| bullist numlist outdent indent | searchreplace fullscreen | help"
Overriding the defaults
To override the default settings, add a new initialization module with a dependency on the default one.
The TinyMceSettings class provides helper methods for setting the most common settings within TinyMCE, which map to the configuration settings documented on TinyMCE's website.
However, you can configure settings that do not have a helper method by using the AddSetting or RawSettings methods.
[ModuleDependency(typeof(TinyMceInitialization))]
public class CustomizedTinyMceInitialization : IConfigurableModule
{
public void Initialize(InitializationEngine context)
{
}
public void Uninitialize(InitializationEngine context)
{
}
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Services.Configure<TinyMceConfiguration>(config =>
{
config.Default()
.BodyClass("custom_body_class")
.ContentCss("/static/css/editor.css")
.AddSetting("directionality", "rtl");
});
}
}
When overriding the defaults, you should call the AddOptimizelySupport method to get the basic Optimizely plugins and styling configured.
[ModuleDependency(typeof(TinyMceInitialization))]
public class CustomizedTinyMceInitialization : IConfigurableModule
{
public void Initialize(InitializationEngine context)
{
}
public void Uninitialize(InitializationEngine context)
{
}
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Services.Configure<TinyMceConfiguration>(config =>
{
config.Default()
.AddOptimizelySupport()
.Toolbar("custom toolbar items");
});
}
}
Related topics
Blog posts
Do you find this information helpful? Please log in to provide feedback.
Last updated: Jul 02, 2021