Element creation

If configured by the administrator the following options are available:

  • Insertion of elements via the add element menu can now insert element templates including attributes and child elements.
  • When editing elements, new template based sibling elements can be inserted by pressing return.
  • Templates are defined within a template element as part of the ui-description of a storage item node source (Path ui-description/elements/element/templates/template).

  • The element that will have the focus after insertion needs to contain the focus attribute with value true from the censhare namespace (see example)
  • Possible attributes for the template element are
    • on-key: hotkey to trigger the template, default is return, required for all non-default templates. Currently return is the only supported value.
    • when-parent: parent path condition, default is no condition, optional, matched by path depth and document order
    • insertion-path: path to the previous ancestor for the insertion, default is current element, optional, only (../)+ allowed
    • To define the default template to be used by the add element menu omit any attributes on the template element

Example:

<? xml version = "1.0" encoding = "UTF-8" ?>
< ui-description >
   < elements >
     < element name = "paragraph" icon = "cs-icon-paragraph" >
       < renderer >
     < csContentEditorInlineTextRenderer style = "" />
       </ renderer >
       < templates >
     <!– first template in document order without on-key is default for add menu –>
     < template >
       < paragraph >Dummy text</ paragraph >
     </ template >
     <!–
          on-key: hotkey, default is return, required for all non-default templates
          when-parent: parent path condition, default is no condition, optional, matched by path depth and document order
          insertion-path: path to the previous sibling for the insertion, default is current element, optional, only (../)+ allowed
     –>
     < template on-key = "return" when-parent = "bullet-list/item" insertion-path = "../" >
       < item >< paragraph xmlns:censhare = "http://www.censhare.com/xml/3.0.0/censhare" censhare:focus = "true" ></ paragraph ></ item >
     </ template >
       </ templates >
     </ element >
   </ elements >
</ ui-description >

Element grouping

The elements in the “create element” list can be grouped. The groups are declared in ui definition xml of the according storage node source. Groups are identified by their name. To declare a group create a group element, with attribute name containing the groups unique name, as a child of the groups element below the ui-description element. To assign a element to a group simple add the attribute group containing the name of the group, to the element node. E.g.:

<? xml version = "1.0" encoding = "UTF-8" ?>
< ui-description >
   < groups >
     < group name = "important" />  <!– groups sorted by document order –>
   </ groups >
 
   < elements >
     < element name = "content" icon = "cs-icon-content" group = "important" />
   </ elements >
</ ui-description >

  • The groups are ordered in document order.
  • The elements within the group are order alphabetically in relation to their localized display name.
  • Elements that are not assigned to any group are implicitly assigned to a default group that will be displayed as last group.