Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ContextMenu

An object which implements a universal context menu. The namespace for the ContextMenu class statics.

Notes

The items shown in the context menu are determined by CSS selector matching against the DOM hierarchy at the site of the mouse click. This is similar in concept to how keyboard shortcuts are matched in the command registry.

Hierarchy

  • ContextMenu

Index

Interfaces

Constructors

Properties

Methods

Constructors

constructor

Properties

Private _idTick

_idTick: number = 0

Private _items

_items: IItem[] = []

menu

menu: Menu

The menu widget which displays the matched context items.

Methods

addItem

  • Add an item to the context menu.

    Parameters

    Returns IDisposable

    A disposable which will remove the item from the menu.

open

  • open(event: MouseEvent): boolean
  • Open the context menu in response to a 'contextmenu' event.

    Parameters

    • event: MouseEvent

      The 'contextmenu' event of interest.

    Returns boolean

    true if the menu was opened, or false if no items matched the event and the menu was not opened.

    Notes

    This method will populate the context menu with items which match the propagation path of the event, then open the menu at the mouse position indicated by the event.

Generated using TypeDoc