Constructor
new SelectionContextMenu(x, y, callbacks)
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x | number | Preferred left position in viewport pixels. | ||||||||||||||||||||
y | number | Preferred top position in viewport pixels. | ||||||||||||||||||||
callbacks | object | Callback functions for menu actions.Properties
|
Example
const menu = new SelectionContextMenu(event.clientX, event.clientY, {
onAddLink: () => { handleHyperlink(); },
onSearchText: () => { handleSearch(); },
onGenerateLiveQuote: () => { handleEmbed(); }, // null to hide
onDismiss: () => { menu.close(); },
});
// Later:
menu.close();Classes
Methods
close()
Removes the menu from the DOM.