Merge branch 'master' into feature/tab-preview-mode

This commit is contained in:
Jan Prochazka
2024-11-22 08:35:28 +01:00
9 changed files with 68 additions and 5 deletions

View File

@@ -155,6 +155,19 @@
);
const closeOthersInMultiTab = multiTabIndex =>
closeTabFunc((x, active) => x.tabid != active.tabid && (x.multiTabIndex || 0) == multiTabIndex);
const reopenClosedTab = () => {
const lastClosedTabId = getOpenedTabs()
.filter(x => x.closedTime)
.sort((a, b) => b.closedTime - a.closedTime)[0]?.tabid;
if (!lastClosedTabId) return;
openedTabs.update(x =>
x.map(tab =>
tab.tabid === lastClosedTabId ? { ...tab, selected: true, closedTime: null } : { ...tab, selected: false }
)
);
};
function getTabDbName(tab, connectionList) {
if (tab.tabComponent == 'ConnectionTab') return 'Connections';
@@ -224,7 +237,12 @@
category: 'Tabs',
name: 'Close tab',
keyText: isElectronAvailable() ? 'CtrlOrCommand+W' : null,
testEnabled: () => getOpenedTabs().filter(x => !x.closedTime).length >= 1,
testEnabled: () => {
const hasAnyOtherTab = getOpenedTabs().filter(x => !x.closedTime).length >= 1;
const hasAnyModalOpen = getOpenedModals().length > 0;
return hasAnyOtherTab && !hasConfirmModalOpen;
},
onClick: closeCurrentTab,
});
@@ -244,6 +262,15 @@
onClick: closeTabsButCurrentDb,
});
registerCommand({
id: 'tabs.reopenClosedTab',
category: 'Tabs',
name: 'Reopen closed tab',
keyText: 'CtrlOrCommand+Shift+T',
testEnabled: () => getOpenedTabs().filter(x => x.closedTime).length >= 1,
onClick: reopenClosedTab,
});
registerCommand({
id: 'tabs.addToFavorites',
category: 'Tabs',
@@ -283,6 +310,7 @@
draggingDbGroupTarget,
draggingTab,
draggingTabTarget,
getOpenedModals,
} from '../stores';
import tabs from '../tabs';
import { setSelectedTab, switchCurrentDatabase } from '../utility/common';