feat(shortcuts): add close other tabs shortcut
This commit is contained in:
1 parent
e143a76e1f
commit
d2975fc015
7 files changed
+127
-5
No files matched your search
@@ -185,6 +185,26 @@ function closeAllRegularSurfaces() {
|
||||
closeSpecialRegularSurfaces();
|
||||
}
|
||||
|
||||
function closeOtherActiveTabs() {
|
||||
if (props.settingsPageActive) {
|
||||
queryStore.closeRegularTabs();
|
||||
closeSpecialRegularSurfaces("settings");
|
||||
return;
|
||||
}
|
||||
if (props.driverStoreActive) {
|
||||
queryStore.closeRegularTabs();
|
||||
closeSpecialRegularSurfaces("driverStore");
|
||||
return;
|
||||
}
|
||||
|
||||
const tab = queryStore.tabs.find((item) => item.id === queryStore.activeTabId);
|
||||
if (!tab) return;
|
||||
if (tab.pinned) queryStore.closeOtherFixedTabs(tab.id);
|
||||
else closeOtherRegularTabsFromTab(tab);
|
||||
}
|
||||
|
||||
defineExpose({ closeOtherActiveTabs });
|
||||
|
||||
function getSpecialRegularTabMenuItems(surface: SpecialRegularSurface): ContextMenuItem[] {
|
||||
const keep = surface;
|
||||
const closeCurrent = surface === "driverStore" ? () => emit("close-driver-store") : () => emit("close-settings-page");
|
||||
@@ -208,6 +228,7 @@ function getSpecialRegularTabMenuItems(surface: SpecialRegularSurface): ContextM
|
||||
},
|
||||
disabled: closeOtherDisabled,
|
||||
icon: X,
|
||||
shortcut: settingsStore.editorSettings.shortcuts.closeOtherTabs,
|
||||
},
|
||||
{
|
||||
label: closeAllLabel,
|
||||
@@ -270,6 +291,7 @@ function getTabMenuItems(tab: QueryTab): ContextMenuItem[] {
|
||||
action: closeOtherAction,
|
||||
disabled: closeOtherDisabled,
|
||||
icon: X,
|
||||
shortcut: settingsStore.editorSettings.shortcuts.closeOtherTabs,
|
||||
},
|
||||
{
|
||||
label: closeAllLabel,
|
||||
|
||||
Reference in new issue
Block a user