An interface describing a context menu item

interface IContextMenuItem {
    args?: PartialJSONObject;
    command?: string;
    disabled?: boolean;
    rank?: number;
    selector: string;
    submenu?: null | IMenu;
    type?: "separator" | "command" | "submenu";
}

Hierarchy (view full)

Properties

args?: PartialJSONObject

The arguments for the command.

The default value is an empty object.

command?: string

The command to execute when the item is triggered.

The default value is an empty string.

disabled?: boolean

Whether a menu item is disabled. false by default.

Notes

This allows an user to suppress menu items.

rank?: number

The rank order of the menu item among its siblings.

selector: string

The CSS selector for the context menu item.

The context menu item will only be displayed in the context menu when the selector matches a node on the propagation path of the contextmenu event. This allows the menu item to be restricted to user-defined contexts.

The selector must not contain commas.

submenu?: null | IMenu

The submenu for a 'submenu' type item.

The default value is null.

type?: "separator" | "command" | "submenu"

The type of the menu item.

The default value is 'command'.