mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 21:56:00 +00:00
context menu activator #810
This commit is contained in:
@@ -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
|
||||
|
||||
13
packages/web/src/utility/contextMenuActivator.ts
Normal file
13
packages/web/src/utility/contextMenuActivator.ts
Normal 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);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user