1. Reference

<command
  name = NMTOKEN (optionally preceded by
  a command namespace in XMLmind XML Editor - Configuration and Deployment) 
>
  Content: class | menu | macro | process
</command>

<menu
  label = non empty token
>
  Content: [ menu | separator | item ]+
</menu>

<separator
/>

<item
  label = non empty token
  icon = anyURI
  command = NMTOKEN (optionally preceded by
  a command namespace in XMLmind XML Editor - Configuration and Deployment)
  parameter = string
/>

Define a popup menu of commands. This special type of command, typically invoked from contextual macro-commands, allow to redefine or extend the right-click, contextual, popup menu. See below.

The parameter passed to a command containing a menu may be used to parameterize the items of this menu. This parameter is split like in a command line. A part of the split parameter may be referenced as variable %0, %1, %2, ..., %9. Variable %* may be used to reference the whole parameter of the command.

Note that the %-variable substitution is performed on in the label and in the parameter attributes of an item element. There is no %-variable substitution in the command attribute.

Example:

<command name="greetings">
  <menu>
    <item label="Say '%0'" 
          command="alert" parameter="%0"/>
    <item label="Say '%1'"
          command="alert" parameter="%1"/>
  </menu>
</command>

Invoking <command name="greetings" parameter="'Hello world!' 'Goodbye world.'"/> displays a popup menu equivalent to:

<menu>
  <item label="Say 'Hello world!'" 
        command="alert" parameter="Hello world!"/>
  <item label="Say 'Goodbye world.'"
        command="alert" parameter="Goodbye world."/>
</menu>

Note

The binding configuration element (see Section 3, “binding” in XMLmind XML Editor - Configuration and Deployment) also has a menu child element. However menu commands are more useful because:

  • They can be bound to a keystroke. Popup menus in binding can only be bound to a mouse click.

  • The parameter passed to the command may be used to parameterize the items of the menu.

  • They can be used to redefine or extend the right-click, contextual, popup menu.