<customComboBoxItem> Configuration Element

This element specifies the properties for a developer defined custom combo box item for use within Ephox EditLive! for XML. The custom combo box item must be listed within a <customToolbarComboBox> element and will therefore appear on one of the toolbars within EditLive! for XML.

Configuration Element Tree Structure

<editLive>
     ...
     <toolbars>
          <toolbar>
               <customToolbarComboBox>
                    <customComboBoxItem ... />
               </customToolbarComboBox>
          </toolbar>
     </toolbars>
     ...
</editLive>

Required Attributes

name

The name which uniquely defines this custom combo box item within the <customToolbarComboBox> element. This means that there cannot be two <customComboBoxItem> elements with the same name within one <customToolbarComboBox> element.

text

The text to represent this item within the combo box it is to be listed in.

action

The action which this menu item performs when clicked on.

Note

This attribute has the following possible values:

  • insertHTMLAtCursor - Insert the given HTML at the cursor

  • insertHyperlinkAtCursor - Insert the given hyperlink at the cursor

  • raiseEvent -Call a JavaScript function with the name specified in the value attribute. An event is also fired to the ELXBean using this XML configuration file. The following values will be assigned to the TextEvent sent with the event:

    • Action Command = TextEvent.CUSTOM_ACTION

    • Extra String = the string specified in the value attribute

    • Extra Object = a Java Map containing the attributes of the element selected when the custom menu item was selected. In the case of this example, this element will be a <td> element.

    The event sent to the bean will also have the value TextEvent.CustomAction.RAISE_EVENT added to the extra int property of the event.

    When the event has been handled (by using the event method setHandled(boolean b), where b = true), the javascript function defined in value will be called.

  • customPropertiesDialog - Fires an event for the ELXBean using this XML configuration file. The following values will be assigned to the TextEvent sent with the event:

    • Action Command = TextEvent.SHOW_CUSTOM_PROPERTIES

    • Extra String = the string specified in the value attribute

    • Extra Object = a Java Map containing the attributes of the element selected when the custom menu item was selected. In the case of this example, this element will be a <td> element.

value

The value of this attribute depends on the value specified in the action attribute

  • insertHTMLAtCursor - value will be a string of HTML.

  • InsertHyperlinkAtCursor - value will be a URL

  • raiseEvent - value will be the name of a JavaScript function

  • customPropertiesDialog - value will be the Extra String field of the TextEvent sent with the ELXBean event.

Note

When using the insertHTMLAtCursor action the HTML to be inserted must be URL encoded in the XML file. For example, <p>HTML to insert<p> becomes %3Cp%3EHTML%20to%20insert%3C/p%3E.

Example

The following example demonstrates how to define a custom combo box item for use within a custom combo box which exists on the EditLive! for Java Command Toolbar. The combo box item defined in this example will insert HTML to insert at the cursor, note that the value in the example below is URL encoded.

<editLive>
    ...
    <toolbars>
        <toolbar name="command">
            <customToolbarComboBox name="customCombo">
                <customComboBoxItem 
                    name="customComboItem1" 
                    text="Custom Combo Item" 
                    action="insertHTMLAtCursor" 
                    value="%3Cp%3EHTML%20to%20insert%3C/p%3E" />
            </customToolbarComboBox>
        </toolbar>
    </toolbars>
    ...
</editLive> 

Remarks

The <customComboBoxItem> element can appear multiple times within the <customToolbarComboBox> element.

The <customComboBoxItem> element must be a complete tag, it cannot contain a tag body. Therefore the tag must be closed in the same line. See the example below:

<customComboBoxItem name=... /> 

Text assigned to the value attribute must be URL encoded as it is in the example above.

See Also