This commit is contained in:
Vanessa 2023-10-25 17:34:07 +08:00
parent 502d38891b
commit 0664aebe15
2 changed files with 9 additions and 20 deletions

View file

@ -329,23 +329,19 @@ export const closeTabByType = async (tab: Tab, type: "closeOthers" | "closeAll"
if (type === "closeOthers") {
for (let index = 0; index < tab.parent.children.length; index++) {
if (tab.parent.children[index].id !== tab.id && !tab.parent.children[index].headElement.classList.contains("item--pin")) {
tab.parent.children[index].parent.removeTab(tab.parent.children[index].id, true, true, false);
await tab.parent.children[index].parent.removeTab(tab.parent.children[index].id, true, true, false);
index--;
}
}
if (!tab.headElement.parentElement.querySelector(".item--focus")) {
tab.parent.switchTab(tab.headElement, true);
}
return
return;
}
if (type === "closeAll") {
for (let index = 0; index < tab.parent.children.length; index++) {
if (!tab.parent.children[index].headElement.classList.contains("item--pin")) {
await tab.parent.children[index].parent.removeTab(tab.parent.children[index].id, true);
index--;
}
}
if (tab.parent.children[0].headElement.parentElement) {
tab.parent.children[0].parent.switchTab(tab.parent.children[0].headElement, true);
}
return;
}
if (tabs.length > 0) {
@ -354,11 +350,5 @@ export const closeTabByType = async (tab: Tab, type: "closeOthers" | "closeAll"
await tabs[index].parent.removeTab(tabs[index].id);
}
}
if (tab.headElement.parentElement && !tab.headElement.parentElement.querySelector(".item--focus")) {
tab.parent.switchTab(tab.headElement, true);
} else if (tab.parent.children[0].headElement.parentElement) {
tab.parent.children[0].parent.switchTab(tab.parent.children[0].headElement, true);
}
return;
}
}
};