Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
This topic explains the architecture and different components of the editing user interface in Episerver. The user interface is pluggable allowing you to plug-in your own gadgets to the panes to extend editing possibilities.
The UI framework has a server-side part that is based on ASP.NET MVC and a client-side part that uses the JavaScript library Dojo. The UI also has context-awareness where it is possible to have a component automatically reload when the context is changed, or to display customized content for that item. You also can load Web Forms pages and user controls into components of the user interface to port existing plug-ins built with ASP.NET user interface.
You can edit content in the user interface in the following ways:
This means that the editor can make changes using different modes without losing context.
Changes are automatically saved to the client state and sent to the server to be persisted. To reduce the burden on the server, synchronization between client and server occurs after a few seconds delay. When a user edits a property or content block, the client creates and stores an undo step in a history that lets the user undo and redo changes. The undo and redo steps are available while the user remains editing the page and are lost when the user leaves the page. Any editing changes are sent to the server and are saved even if the user leaves the page or closes the browser.
Editing components are organized into two layers.
You can enable editing for a specific area by adding the following attribute to the HTML tag: data-epi-property-name="PageName":
<h1 data-epi-property-name="PageName"><%= CurrentPage.PageName %></h1>
Clicking on a node in the following example loads whichever editor is configured for the Pagename property.
A property can appear several times on a page, so you can edit it in multiple places. By editing a property in one place, it updates any other place where the property is used. You can prevent a property from being edited by disabling it, (but the property updates its content if it is edited elsewhere).
Configuration of editors is done separately and does not have to be added to the HTML even if there are a few other data-attributes that you can use to override default behavior.
When an editor is triggered for a property, an editor factory class creates the editor based on the data attributes and metadata for the property. Episerver Framework extracts metadata from the following sources to create an editor.
Note: For a description of the Episerver object editing system, see Object Editing.
You can create page properties from typed model classes and in the administrative user interface. The PageData class assembles metadata using a custom metadata provider that sends the metadata to the client using a RESTful service and is a hierarchical representation of the page and its properties. The following example shows how a property might be described:
{
"name":"PageName",
"modelType":"EPiServer.Core.PropertyString",
"uiType":"dijit.form.ValidationTextBox",
"uiPackage":null,
"customEditorSettings":{"uiWrapperType":"inline","uiType":"epi.cms.widget.ValidationTextBox"},
"layoutType":null,
"defaultValue":null,
"displayName":"Name",
"groupName":null,
"displayOrder":-81,
"settings":{"label":"Name","required":true,"missingMessage":"The Name field is required.","invalidMessage":"The
field Name must be a string with a maximum length of 255.","regEx":"^.{0,255}$","maxLength":255},
"additionalValues":{},
"properties":[],
"groups":null,'
"selections":null
}
The page editing component does the following tasks:
The editable blocks are responsible for editing property data and use a render manager to render property on the page (on either the client side or server side). Server-side rendering uses a queue so that properties are not rendered at the same time. Changing one property can mean that several properties on the page need to be rendered again with different settings.
Clicking on an editable block creates the editor and an editor wrapper for the block. The editor factory decides which wrapper and editor to use depending on the data attributes for editing and metadata for the property. You can connect to an event in editor factory to change the values at runtime.
Data attributes have higher precedence than the metadata. You can choose to use an editor for a property on a page which is not the standard editor for that property. For inline editing, you must use an editor designed for it; in other cases, the editor is a widget.
You can set the values for data-epi-property-editorsettings and data-epi-property-rendersettings through the EditorSettings or RenderSettings properties on either Property web control or on Property data control when using web forms. In MVC, you can pass the values in as anonymous object to PropertyFor helper method. You should pass in the render settings using parameter additionalViewData while you can pass in the editor settings using parameter editorSettings.
Data attribute | Type | Required | Description |
---|---|---|---|
data-epi-property-name | String | Yes | Name of the property. |
data-epi-property-disabled | Boolean | No | You cannot edit this node but it is updated if the property value changes. |
data-epi-useoverlay | Boolean | No | Use overlay when mouse hovers above node to edit. |
data-epi-property-render | String | No | |
data-epi-property-edittype | String | No | Type of wrapper to display editor in. Possible values are: floating (default), flyout, inline, webcontrol. Inline editing is only possible with custom inline editing widgets. Dijit widgets cannot be used inline. |
data-epi-property-editorsettings | JSON | No | Any settings for editor. |
data-epi-property-rendersettings | JSON | No | Settings used to specify rendering, for example, custom tag. |
data-epi-property-editor | String | No | Type name of property editor widget. |
Last updated: Sep 21, 2015