The options for a item in a Context Menu. It encapsulates the jquery-context-menu option.
Properties
childItems
childItems: IContextMenuItem
[]
Child items
These are displayed on the right when a user hovers over this item
disabled
disabled: boolean
When set to true this will disable and gray out the item
icon
icon: string
The name of the icon that will display for the item
Note that these are the build in jquery-context-menu icons and only the following values are supported:
add, copy, cut, delete, edit, loading, paste, quit
onBuildCallback()
onBuildCallback: (contextMenuOptions
, reviewData
, api
) => ContextMenuOption
Callback invoked when the IContextMenu is built
The item will not show up in the IContextMenu if this returns null. Use this callback to decide when to show the item in the menu,
or change components of the option on the fly. For instance, you could disable the item on specific conditions. The callback will have access to
some useful data on reviewData like documentId or workspaceId. It will also have access to the full public API.
Parameters
• contextMenuOptions: ContextMenuOption
• reviewData: IContextMenuReviewData
• api: IReviewInterfaceApi
Returns
ContextMenuOption
onClickCallback()
onClickCallback: (reviewData
, api
) => void
Callback invoked when the item is clicked
The callback will have access to some useful data on reviewData like documentId or workspaceId. It will also have access to the full public API.
Parameters
• reviewData: IContextMenuReviewData
• api: IReviewInterfaceApi
Returns
void
order
order: number
Order in the list of context menu items
permissionCheck?
optional
permissionCheck: IPermissionCheckRequest
Permission check object
rwcIcon?
optional
rwcIcon: string
The name of the RWC icon that will display for the item
Note that if icon is also set, rwcIcon will be ignored
rwcIconClass?
optional
rwcIconClass: string
Class that will be applied to rwcIcon, if set
rwcIconColor?
optional
rwcIconColor: string
Color that will be applied to rwcIcon, if set
text
text: string
The text that will display for the item
visible
visible: boolean
When set to false this will hide the item
Methods
deepCopy()
deepCopy(): IContextMenuItem
Creates a deep copy of the current context menu item.
Returns
IContextMenuItem
A deep copy of the current context menu item.
getOptions()
getOptions(triggerElement
, event
, reviewData
, api
, logger
): ContextMenuOption
Gets back the JQuery Options to be used in the jquery-context-menu build().
Parameters
• triggerElement: any
Name of the element that triggered the build()
• event: any
The event data from jquery-context-menu build()
• reviewData: IContextMenuReviewData
Useful data that will be included for onClick and onBuild of the menu.
• api: IReviewInterfaceApi
The public api that will be included for onClick and onBuild of the menu.
• logger: Logger
The logger to use when encountering errors when building menus.
Returns
ContextMenuOption
The context menu options in a format usable for jquery-context-menu build()