mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
close tab command
This commit is contained in:
parent
a03682fc8a
commit
e7634a2521
@ -51,7 +51,8 @@ function buildMenu() {
|
||||
commandItem('group.save'),
|
||||
commandItem('group.saveAs'),
|
||||
{ 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({
|
||||
idPrefix,
|
||||
category,
|
||||
|
@ -33,6 +33,9 @@
|
||||
}))
|
||||
);
|
||||
};
|
||||
const closeCurrentTab = () => {
|
||||
closeTab(getActiveTabId());
|
||||
};
|
||||
const closeWithSameDb = closeTabFunc(
|
||||
(x, active) =>
|
||||
_.get(x, 'props.conid') == _.get(active, 'props.conid') &&
|
||||
@ -96,6 +99,15 @@
|
||||
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({
|
||||
id: 'tabs.addToFavorites',
|
||||
category: 'Tabs',
|
||||
@ -120,7 +132,7 @@
|
||||
import FavoriteModal from '../modals/FavoriteModal.svelte';
|
||||
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 { setSelectedTab } from '../utility/common';
|
||||
import contextMenu from '../utility/contextMenu';
|
||||
|
Loading…
Reference in New Issue
Block a user