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
onMute: () => { handleMute(); }, // null to hide
onApplyEffect: () => { handleEffect(); }, // null to hide
onDismiss: () => { menu.close(); },
});
// Later:
menu.close();