XHTML Editor - PropertyXHTMLString and PropertyLongString

Product version:

EPiServer CMS 6.0 / R2

Document version:

1.0

Document last saved:

This tech note explains which controls that will be used in edit mode for PropertyLongString and PropertyXhtmlString, and how to configure these the way you want them.

Introduction

There are now three built in controls that can be used:

  • PropertyLongStringControl which will always render a TextBox.
  • PropertyXhtmlStringControl which renders an XHTML (TinyMCE) editor (the new editor in EPiServer CMS 6).
  • LegacyPropertyXhtmlStringControl which renders either a legacy editor or a TextArea depending on the settings for the editor (all editor tools turned off) and the browser used (always TextArea for non-IE browsers).

Default behavior

  • PropertyXhtmlString will be using an XHTML (TinyMCE) editor control.
  • PropertyLongString will be using a TextArea control.

PropertyControlClassFactory

Using the PropertyControlClassFactory you can override the defaults.

Reverting to the Behavior of the EPiServer CMS 5 Editor

If you in the web.config file register the LegacyPropertyXhtmlControl for both PropertyXhtmlString and PropertyLongString, the "old behavior" (legacy editor depending on settings) will be used in Edit mode.

<add type="EPiServer.Core.PropertyControlClassFactory, EPiServer" id="PropertyControlFactory">
        <register type="EPiServer.SpecializedProperties.PropertyXhtmlString, EPiServer" mappedType="EPiServer.Web.PropertyControls.LegacyPropertyXhtmlStringControl, EPiServer" />
        <register type="EPiServer.Core.PropertyLongString, EPiServer" mappedType="EPiServer.Web.PropertyControls.LegacyPropertyXhtmlStringControl, EPiServer" />
</add>

TinyMCE Editor for Both Property Types

Since the default settings gives us a TinyMCE editor for PropertyXhtmlString, we only need to register PropertyLongString to use the PropertyXhtmlStringControl. However, note that this is not really recommended since Dynamic Content and Link parsing will not occur on PropertyLongStrings.

<add type="EPiServer.Core.PropertyControlClassFactory, EPiServer" id="PropertyControlFactory">
        <register type="EPiServer.Core.PropertyLongString, EPiServer" mappedType="EPiServer.Web.PropertyControls.PropertyXhtmlStringControl, EPiServer" />
</add>

Decide in Admin Mode What to use

If you specify more than one control to use for each property type, you will be able to specify which control to use when editing page property types in Admin mode. In Admin mode it is possible to set the Property definition on a more “global” level, for instance on XHtmlStringProperty, or on page type property level, for instance News Page – MainBody.

Without making any changes in Admin mode the default control used will be the first registered type.

The following settings will give an administrator the possibility to choose between the three built in controls. By default the PropertyXhtmlStringControl will be used.

<add type="EPiServer.Core.PropertyControlClassFactory, EPiServer" id="PropertyControlFactory">
        <register type="EPiServer.SpecializedProperties.PropertyXhtmlString, EPiServer" mappedType="EPiServer.Web.PropertyControls.PropertyXhtmlStringControl, EPiServer" />
        <register type="EPiServer.SpecializedProperties.PropertyXhtmlString, EPiServer" mappedType="EPiServer.Web.PropertyControls.LegacyPropertyXhtmlStringControl, EPiServer" />
        <register type="EPiServer.SpecializedProperties.PropertyXhtmlString, EPiServer" mappedType="EPiServer.Web.PropertyControls.PropertyLongStringControl, EPiServer" />
</add>