context menu activator #810

This commit is contained in:
Jan Prochazka
2024-07-30 09:06:25 +02:00
parent 15d99f98f8
commit 74b0216714
2 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
export default function contextMenuActivator(node, activator) {
const handleContextMenu = async e => {
activator.activate();
};
node.addEventListener('contextmenu', handleContextMenu);
return {
destroy() {
node.removeEventListener('contextmenu', handleContextMenu);
},
};
}