mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 16:35:30 +02:00
Fixed closing parent tab on glance
This commit is contained in:
parent
3242919033
commit
76f4f80a75
1 changed files with 22 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
|||
init() {
|
||||
document.documentElement.setAttribute("zen-glance-uuid", gZenUIManager.generateUuidv4());
|
||||
window.addEventListener("keydown", this.onKeyDown.bind(this));
|
||||
window.addEventListener("TabClose", this.onTabClose.bind(this));
|
||||
|
||||
ChromeUtils.defineLazyGetter(
|
||||
this,
|
||||
|
@ -122,7 +123,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
closeGlance({ noAnimation = false } = {}) {
|
||||
closeGlance({ noAnimation = false, onTabClose = false } = {}) {
|
||||
if (this.#animating || !this.#currentBrowser || this.animatingOpen) {
|
||||
return;
|
||||
}
|
||||
|
@ -143,7 +144,12 @@
|
|||
window.requestAnimationFrame(() => {
|
||||
this.browserWrapper.setAttribute("animate", true);
|
||||
setTimeout(() => {
|
||||
if (!this.currentParentTab) {
|
||||
return;
|
||||
}
|
||||
if (!onTabClose) {
|
||||
this.quickCloseGlance({ closeParentTab: false });
|
||||
}
|
||||
this.overlay.setAttribute("hidden", true);
|
||||
this.overlay.removeAttribute("fade-out");
|
||||
this.browserWrapper.removeAttribute("animate");
|
||||
|
@ -155,7 +161,9 @@
|
|||
this.#currentTab = null;
|
||||
this.currentParentTab = null;
|
||||
|
||||
if (!onTabClose) {
|
||||
gBrowser.selectedTab = this.currentParentTab;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
gBrowser.removeTab(this.lastCurrentTab);
|
||||
|
@ -181,6 +189,8 @@
|
|||
this.#currentBrowser.docShellIsActive = true;
|
||||
this.#currentBrowser.setAttribute("zen-glance-selected", true);
|
||||
|
||||
this.currentParentTab._visuallySelected = true;
|
||||
|
||||
this.currentParentTab.linkedBrowser.closest(".browserSidebarContainer").classList.add("zen-glance-background");
|
||||
this._duringOpening = false;
|
||||
}
|
||||
|
@ -197,6 +207,9 @@
|
|||
if (closeCurrentTab) {
|
||||
this.#currentBrowser.docShellIsActive = false;
|
||||
}
|
||||
if (!this.currentParentTab._visuallySelected) {
|
||||
this.currentParentTab._visuallySelected = false;
|
||||
}
|
||||
this.#currentBrowser.removeAttribute("zen-glance-selected");
|
||||
this.currentParentTab.linkedBrowser.closest(".browserSidebarContainer").classList.remove("zen-glance-background");
|
||||
}
|
||||
|
@ -216,6 +229,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
onTabClose(event) {
|
||||
if (event.target === this.currentParentTab) {
|
||||
this.closeGlance({ onTabClose: true });
|
||||
}
|
||||
}
|
||||
|
||||
fullyOpenGlance() {
|
||||
gBrowser._insertTabAtIndex(this.#currentTab, {
|
||||
index: this.#currentTab._tPos + 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue