Interface: IContextMenuFactory

Entity used to create right click IContextMenus on HTMLElements

Methods

createContextMenu()

createContextMenu(parentElement, menuItems, viewerCollection, onBuildReviewData?, applicationWindow?): IContextMenu

Creates an IContextMenu that displays a menu when right clicked

Parameters

parentElement: HTMLElement

Parent element of the context menu.

menuItems: IContextMenuItem[]

Context Menu Items to display on menu build.

viewerCollection: IViewerCollection

Viewer collection to use with review Data

onBuildReviewData?

Optional ContextMenuReviewData returned to the onBuild and onClick handlers. Include custom data here for use on right click.

applicationWindow?: IApplicationWindow

Returns

IContextMenu

Newly created context menu


createContextMenuById()

createContextMenuById(parentElementId, menuItems, viewerCollection, onBuildReviewData?, applicationWindow?): IContextMenu

Creates an IContextMenu that displays a menu when right clicked

Parameters

parentElementId: string

Parent element id of the context menu.

menuItems: IContextMenuItem[]

Context Menu Items to display on menu build.

viewerCollection: IViewerCollection

Viewer collection to use with review Data

onBuildReviewData?

Optional ContextMenuReviewData returned to the onBuild and onClick handlers. Include custom data here for use on right click.

applicationWindow?: IApplicationWindow

Returns

IContextMenu

Newly created context menu


createContextMenuItem()

createContextMenuItem(name, order, icon?, disabled?, childItems?, onClickCallback?, onBuildCallback?): IContextMenuItem

Parameters

name: string

Name and text of the context menu item

order: number

Position in the list of context menu items

icon?: string

Icon to display

disabled?: boolean

Whether the option is enabled or disabled

childItems?: IContextMenuItem[]

Child context menu items

onClickCallback?

onClick callback for the option

onBuildCallback?

onClick callback for the option

Returns

IContextMenuItem

Newly created context menu item

Deprecated

Use createContextMenuItemFromConfig instead

Creates an IContextMenuItem


createContextMenuItemFromConfig()

createContextMenuItemFromConfig(config): IContextMenuItem

Creates an IContextMenuItem

Parameters

config: IContextMenuItemConfig

Configuration of the context menu to create

Returns

IContextMenuItem

Newly created context menu item


getContextMenu()

getContextMenu(parentElement): IContextMenu

Gets an IContextMenu by parent HTMLElement

Parameters

parentElement: HTMLElement

Parent element of the context menu to get

Returns

IContextMenu


getContextMenuById()

getContextMenuById(parentElementId): IContextMenu

Retrieves an IContextMenu by parent HTMLElement ID

Parameters

parentElementId: string

Id of the parent element's context menu to find

Returns

IContextMenu


removeContextMenu()

removeContextMenu(parentElement): void

Removes an existing IContextMenu

Parameters

parentElement: HTMLElement

Parent element of the context menu to remove

Returns

void


removeContextMenuById()

removeContextMenuById(parentElementId): void

Removes a context menu object that already exists

Parameters

parentElementId: string

Id of the parent element's context menu to remove.

Returns

void