The HTML element that contains the context menu targets.
A CSS selector which activates the context menu.
An Array of entries to display in the menu
Optional
options: ContextMenuOptions = {}Additional options to configure the context menu.
The array of menu items to render.
A function to call when the context menu is closed.
A function to call when the context menu is opened.
The menu element.
The event name to listen for.
Check which direction the menu is expanded in.
Whether to position the context menu as a fixed element, or inject it into the target.
A CSS selector to identify context menu targets.
The parent HTML element to which the context menu is attached
Static
implementationRetrieve the configured DragDrop implementation.
Local listeners which apply to each ContextMenu instance which is created.
The context menu element.
Closes the menu and removes it from the DOM.
Optional
options: { animate?: boolean; target?: HTMLElement } = {}Options to configure the closing behavior.
Optional
animate?: booleanAnimate the context menu closing.
Optional
target?: HTMLElementThe target element to close on.
Render the Context Menu by iterating over the menuItems it contains. Check the visibility of each menu item, and only render ones which are allowed by the item's logical condition. Attach a click handler to each item which is rendered.
The target element to which the context menu is attached.
Optional
options: ContextMenuRenderOptions = {}A Promise that resolves when the open animation has completed.
Protected
_animateProtected
Animate the context menu's height when opening or closing.
Whether the menu is opening or closing.
A Promise that resolves when the animation completes.
Protected
_closeProtected
Close the menu and remove it from the DOM.
Optional
options: { target?: HTMLElement } = {}Optional
target?: HTMLElementThe target element to close on.
Protected
_injectProtected
Inject the menu inside the target.
The menu element.
The context target.
Protected
_onProtected
Handle context menu activation.
The triggering event.
Protected
_onProtected
Called after the context menu has finished rendering and animating open.
Optional
options: ContextMenuRenderOptions = {}Protected
_preProtected
Called before the context menu begins rendering.
The context target.
Optional
options: ContextMenuRenderOptions = {}Protected
_setProtected
Set the context menu at a fixed position in the viewport.
The menu element.
The context target.
Optional
options: { event?: Event } = {}Optional
event?: EventThe event that triggered the context menu opening.
Protected
_setProtected
Set the position of the context menu, taking into consideration whether the menu should expand upward or downward
The context menu element.
The element that the context menu was spawned on.
Optional
options: { event?: Event } = {}Optional
event?: EventThe event that triggered the context menu opening.
Static
createCreate a ContextMenu for this Application and dispatch hooks.
The Application this ContextMenu belongs to.
The Application's rendered HTML.
The target CSS selector which activates the menu.
The array of menu items being rendered.
Optional
options: { hookName?: string } = {}Additional options to configure context menu initialization.
Optional
hookName?: stringThe name of the hook to call.
Static
eventGlobal listeners which apply once only to the document.
Display a right-click activated Context Menu which provides a dropdown menu of options. A ContextMenu is constructed by designating a parent HTML container and a target selector. An Array of menuItems defines the entries of the menu which is displayed.