mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
context menu activator #810
This commit is contained in:
parent
15d99f98f8
commit
74b0216714
@ -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);
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user