@vttforge/types / ContextMenuEntry
Interface: ContextMenuEntry ​
One entry of a context menu.
v14 renamed three fields: name is label, condition is visible, and callback is onClick. The old names still work and log a deprecation warning; they are removed in v16. Both shapes are described here, and the v14 ones are the ones to write.
Properties ​
callback? ​
optionalcallback?: (target) =>void
Parameters ​
target ​
HTMLElement
Returns ​
void
Deprecated ​
v14 calls this onClick, and hands it the event first. Removed in v16.
classes? ​
optionalclasses?:string
condition? ​
optionalcondition?:boolean| ((target) =>boolean)
Deprecated ​
v14 calls this visible. Removed in v16.
group? ​
optionalgroup?:string
icon? ​
optionalicon?:string
label? ​
optionallabel?:string
The text on the entry.
name? ​
optionalname?:string
Deprecated ​
v14 calls this label. Removed in v16.
onClick? ​
optionalonClick?: (event,target) =>unknown
Two arguments, unlike the v13 callback, which took only the row.
Parameters ​
event ​
Event
target ​
HTMLElement
Returns ​
unknown
visible? ​
optionalvisible?:boolean| ((target) =>boolean)
Whether to draw the entry at all.
Both this and onClick receive the row the menu was opened on, not a document. Resolve the document from the element's dataset.