ContextualOperation

Type: Object

Defines the 'contextual operations' of nodes matching a given selector. These are shown in places like the structure view, the elements menu button in the content view, the breadcrumbs bar or the context menu.

The hideIn property describes in which views the operation is not applicable. This is optional and defaults to hiding nowhere. Possible values are 'context-menu', 'element-menu', 'breadcrumbs-menu' and 'structure-view'.

  • context-menu: The right click mouse menu, opens when the user right clicks on an element with contextual operations.

  • element-menu: A menu configured by the createElementMenuButtonWidget. The element-menu is also by default on the table cell, but will only show up when there are contextual operations for the element-menu available on the cell element.

  • breadcrumbs-menu: When the cursor is placed in an element with contextual operations, then you will find this element in the breadcrumbs together with breadcrumbs menu.

  • structure-view: You can find this menu in the outline sidebar for elements that are configured as configureAsStructureViewItem.

Besides specifying 'contextual operations' using the name and optional hideIn properties, like so:

  • Regular contextual operation reference { name: string, hideIn?: string[] },

you can also define two other shapes of objects in this array:

  • Menu group with array of contents { menuGroupHeading?: string, hideIn?: string[], contents: ContextualOperation[] }

or,

  • Sub menu item with array of contents { subMenuLabel: string, subMenuIcon?: string, hideIn?: string[], contents: ContextualOperation[] }

Properties

Name Type Description
contents Array<ContextualOperation>

Nested contextual operation definitions. Depending on whether subMenuLabel or menuGroupHeading or neither is specified it uses these contents as the children of a sub menu or menu group or empty menu group respectively.

hideIn Array<String>

Where the operations should be hidden from view in a certain context; Possible values are 'context-menu', 'element-menu', 'breadcrumbs-menu' or 'structure-view'.

[menuGroupHeading] String

The text of the menu group heading.

[name] String

The name of a the contextual operation

[subMenuIcon] String

The icon of the sub menu item.

[subMenuLabel] String

The text of the sub menu item.

Was this page helpful?