diff --git a/packages/web/src/buttons/ToolStripButton.svelte b/packages/web/src/buttons/ToolStripButton.svelte index f4e7ee2f..7016bd0c 100644 --- a/packages/web/src/buttons/ToolStripButton.svelte +++ b/packages/web/src/buttons/ToolStripButton.svelte @@ -11,7 +11,7 @@ function handleClick(e) { if (disabled) return; - dispatch('click'); + dispatch('click', { target: e.target }); } diff --git a/packages/web/src/buttons/ToolStripDropDownButton.svelte b/packages/web/src/buttons/ToolStripDropDownButton.svelte index 82b6de12..5a06ab9a 100644 --- a/packages/web/src/buttons/ToolStripDropDownButton.svelte +++ b/packages/web/src/buttons/ToolStripDropDownButton.svelte @@ -1,16 +1,18 @@ @@ -135,6 +150,8 @@ + + diff --git a/packages/web/src/tabs/ViewDataTab.svelte b/packages/web/src/tabs/ViewDataTab.svelte index 737901d2..fb38195d 100644 --- a/packages/web/src/tabs/ViewDataTab.svelte +++ b/packages/web/src/tabs/ViewDataTab.svelte @@ -8,6 +8,8 @@ import { findEngineDriver } from 'dbgate-tools'; import { setContext } from 'svelte'; import { writable } from 'svelte/store'; +import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte'; +import ToolStripContainer from '../buttons/ToolStripContainer.svelte'; import DataGrid from '../datagrid/DataGrid.svelte'; import SqlDataGridCore from '../datagrid/SqlDataGridCore.svelte'; @@ -51,16 +53,22 @@ {#if display} - + + + + + + + {/if} { if (command.getSubCommands) visibleCommandPalette.set(command); diff --git a/packages/web/src/utility/createQuickExportMenu.ts b/packages/web/src/utility/createQuickExportMenu.ts index 4b6e0086..5872ade5 100644 --- a/packages/web/src/utility/createQuickExportMenu.ts +++ b/packages/web/src/utility/createQuickExportMenu.ts @@ -1,6 +1,20 @@ import { ExtensionsDirectory, QuickExportDefinition } from 'dbgate-types'; import getElectron from './getElectron'; +export function createQuickExportMenuItems( + extensions: ExtensionsDirectory, + handler: (fmt: QuickExportDefinition) => Function +) { + const electron = getElectron(); + if (!electron) { + return null; + } + return extensions.quickExports.map(fmt => ({ + text: fmt.label, + onClick: handler(fmt), + })); +} + export default function createQuickExportMenu( extensions: ExtensionsDirectory, handler: (fmt: QuickExportDefinition) => Function @@ -11,9 +25,6 @@ export default function createQuickExportMenu( } return { text: 'Quick export', - submenu: extensions.quickExports.map(fmt => ({ - text: fmt.label, - onClick: handler(fmt), - })), + submenu: createQuickExportMenuItems(extensions, handler), }; }