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

@ -401,6 +401,7 @@
import { getDatabaseInfo, useDatabaseStatus } from '../utility/metadataLoaders';
import { showSnackbarSuccess } from '../utility/snackbar';
import { openJsonLinesData } from '../utility/openJsonLinesData';
import contextMenuActivator from '../utility/contextMenuActivator';
export let onLoadNextData = undefined;
export let grider = undefined;
@ -1785,6 +1786,7 @@
bind:clientWidth={containerWidth}
bind:clientHeight={containerHeight}
use:contextMenu={buildMenu}
use:contextMenuActivator={activator}
on:wheel={handleGridWheel}
>
<input

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);
},
};
}