A contextualmenuitems section specifies custom context menu items.
contextualmenuitems
-
Use this element to add menu items to the context menu of any element matching the XPath expression specified in the required
xpath attribute.
-
If you define a
contextualmenuitems element with no contextualmenuitem entries, the matching elements will not show a context menu. Here is an example of a contextualmenuitems element that suppresses the context menu of the p element:
<contextualmenuitems xpath="self::p"/>
-
You can add
contextualmenuitems as a child element to the following behavior elements:
definitiontable (and rows in definitiontable)
items in list
image
block
title
sheetbody
contextualmenuitem
-
The element that defines an additional menu item in the context menu. It can contain the following child elements:
- a required
label child element
- either an
inserttemplate or a toggletemplate child element
-
Here is an example of a
contextualmenuitem element that adds a context menu item labeled "Insert block of code" to the context menu for a p element:
<contextualmenuitems xpath="self::p"/>
<contextualmenuitem>
<label>Insert block of code</label>
<inserttemplate>
<codeblock/>
</inserttemplate>
<contextualmenuitem>
</contextualmenuitems>
label
-
The label of the menu item.
inserttemplate
-
Use this element to specify a certain XML structure (provided within the
inserttemplate element), to inserted below the current element or below the ancestor element specified in the xpath attribute of the menuitem element.
-
An optional
specialbehavior attribute with value repositoryimageselector can be used to specify that you want to pick an image using a Repository browse dialog.
-
Typically, you would use insert templates for all elements that allow a
menuitems child element, except for the inline and highlighting elements.
-
Here is an example of an
inserttemplate element that inserts a definition list:
<inserttemplate>
<dl>
<dlhead>
<dthd/>
<ddhd/>
</dlhead>
<dlentry>
<dt/>
<dd/>
</dlentry>
</dl>
</inserttemplate>
-
And here is an example of an
inserttemplate element that inserts an image, to be selected by the author:
<inserttemplate specialbehavior="showrepositoryimageselector">
<image placement="break" href="{{reference}}"/>
</inserttemplate>
toggletemplate
-
Use
toggletemplate to insert the specified XML element if no text is selected or to wrap or unwrap the currently selected text within the specified element.
-
The
toggletemplate element has a required elementname attribute.
-
Typically, you would use a toggle template for
inline or highlighting elements.
-
Here is an example of a
toggletemplate element:
<toggletemplate elementname="keyword"/>