close tab command

This commit is contained in:
Jan Prochazka
2021-09-28 08:26:17 +02:00
parent a03682fc8a
commit e7634a2521
3 changed files with 24 additions and 2 deletions

View File

@@ -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';