mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 12:43:58 +00:00
close tab command
This commit is contained in:
@@ -51,7 +51,8 @@ function buildMenu() {
|
|||||||
commandItem('group.save'),
|
commandItem('group.save'),
|
||||||
commandItem('group.saveAs'),
|
commandItem('group.saveAs'),
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ role: 'close' },
|
commandItem('tabs.closeTab'),
|
||||||
|
commandItem('file.exit'),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -266,6 +266,15 @@ if (hasPermission('settings/change')) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (electron) {
|
||||||
|
registerCommand({
|
||||||
|
id: 'file.exit',
|
||||||
|
category: 'File',
|
||||||
|
name: 'Exit',
|
||||||
|
onClick: () => electron.remote.getCurrentWindow().close(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function registerFileCommands({
|
export function registerFileCommands({
|
||||||
idPrefix,
|
idPrefix,
|
||||||
category,
|
category,
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const closeCurrentTab = () => {
|
||||||
|
closeTab(getActiveTabId());
|
||||||
|
};
|
||||||
const closeWithSameDb = closeTabFunc(
|
const closeWithSameDb = closeTabFunc(
|
||||||
(x, active) =>
|
(x, active) =>
|
||||||
_.get(x, 'props.conid') == _.get(active, 'props.conid') &&
|
_.get(x, 'props.conid') == _.get(active, 'props.conid') &&
|
||||||
@@ -96,6 +99,15 @@
|
|||||||
onClick: closeAll,
|
onClick: closeAll,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerCommand({
|
||||||
|
id: 'tabs.closeTab',
|
||||||
|
category: 'Tabs',
|
||||||
|
name: 'Close tab',
|
||||||
|
keyText: 'Ctrl+W',
|
||||||
|
testEnabled: () => getOpenedTabs().filter(x => !x.closedTime).length >= 1,
|
||||||
|
onClick: closeCurrentTab,
|
||||||
|
});
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
id: 'tabs.addToFavorites',
|
id: 'tabs.addToFavorites',
|
||||||
category: 'Tabs',
|
category: 'Tabs',
|
||||||
@@ -120,7 +132,7 @@
|
|||||||
import FavoriteModal from '../modals/FavoriteModal.svelte';
|
import FavoriteModal from '../modals/FavoriteModal.svelte';
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
|
|
||||||
import { currentDatabase, getActiveTab, getOpenedTabs, openedTabs, activeTabId } from '../stores';
|
import { currentDatabase, getActiveTab, getOpenedTabs, openedTabs, activeTabId, getActiveTabId } from '../stores';
|
||||||
import tabs from '../tabs';
|
import tabs from '../tabs';
|
||||||
import { setSelectedTab } from '../utility/common';
|
import { setSelectedTab } from '../utility/common';
|
||||||
import contextMenu from '../utility/contextMenu';
|
import contextMenu from '../utility/contextMenu';
|
||||||
|
|||||||
Reference in New Issue
Block a user