<customMenuItem> Configuration Element

This element specifies the properties for a developer defined custom menu item for use within Ephox EditLive! for XML.

Configuration Element Tree Structure

<editLive>
     ...
     <menuBar>
          ...
          <menu>
               <customMenuItem... />
          </menu>
          ...
     </menuBar>
     ...
</editLive>

Required Attributes

name

The name which uniquely defines this custom menu item.

text

The text to place on the menu for this item.

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 given name

  • customPropertiesDialog - Call a JavaScript function with the given name and pass it the current tag's properties

  • PostDocument - Post the content of the applet to a server side script

value

The value of the text or hyperlink to be inserted or the name of the JavaScript function to be called when this menu item is clicked.

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.

Optional Attributes

imageURL

The URL of the image to be placed on the menu with the menu item text. The image should be of a .gif format and be a size of sixteen (16) pixels high and sixteen (16) pixels wide.

Note

This URL can be relative or absolute. Relative URLs are relative to the location of the page in which EditLive! for XML is embedded.

xhtmlonly

This attribute defines whether the custom menu item should be active only when the cursor is placed within an XHTML section. Setting this attribute to true will ensure that the menu item is only active when the cursor is within an XHTML section.

Default: false

enableintag

This attribute defines in which tags the function should be enabled. For example, when set to td the function will be enabled when the cursor is within a <td> tag (i.e. a table cell).

Examples

The following example demonstrates how to define a custom menu item for use within EditLive! for XML. The menu 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>
    ...
    <menuBar>
        ...
        <menu name="Example">
            <customMenuItem 
                name="customItem1" 
                text="Custom Item" 
                imageURL="http://www.someserver.com/image16x16.gif"
                action="insertHTMLAtCursor" 
                value="%3Cp%3EHTML%20to%20insert%3C/p%3E" />
        </menu>
        ...
    </menuBar>    
    ...
</editLive> 

The following example demonstrates how to define a custom properties dialog which is launched from a custom menu item for use within EditLive! for XML. The custom properties dialog will be available for use when the cursor is inside any <td> tag.

<editLive>
  ...
  <menuBar>
    ...
    <menu name="Example">
      <customMenuItem 
        name="customProperties1" 
        text="Custom td Properties" 
        action="customPropertiesDialog" 
        value="customTDFunction" 
        enableintag="td"
      />
    </menu>
    ...
  </menuBar>    
  ...
</editLive> 

Remarks

The <customMenuItem> element can appear multiple times within the <menu> element.

The <customMenuItem> 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:

<customMenuItem name=... />
Text assigned to the value attribute must be URL encoded as it is in the example above.

See Also