forked from ZenBrowserMirrors/zen-desktop
feat: Disable opening link on split view if the limit is reached, b=(no-bug), c=common, split-view
This commit is contained in:
parent
4d27f9d741
commit
b8213569e5
2 changed files with 21 additions and 1 deletions
|
@ -87,7 +87,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async #waitAndCleanup() {
|
async #waitAndCleanup() {
|
||||||
await SessionStore.promiseInitialized;
|
await SessionStore.promiseAllWindowsRestored;
|
||||||
await this.#resolveGlanceTabs();
|
await this.#resolveGlanceTabs();
|
||||||
this.#cleanup();
|
this.#cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1151,6 +1151,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
this.tabBrowserPanel.removeAttribute('zen-split-view');
|
this.tabBrowserPanel.removeAttribute('zen-split-view');
|
||||||
this.currentView = -1;
|
this.currentView = -1;
|
||||||
this.toggleWrapperDisplay(false);
|
this.toggleWrapperDisplay(false);
|
||||||
|
this.maybeDisableOpeningTabOnSplitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1308,6 +1309,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.maybeDisableOpeningTabOnSplitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1861,6 +1863,24 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
this.onLocationChange(gBrowser.selectedTab.linkedBrowser);
|
this.onLocationChange(gBrowser.selectedTab.linkedBrowser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maybeDisableOpeningTabOnSplitView() {
|
||||||
|
document
|
||||||
|
.getElementById('cmd_zenSplitViewLinkInNewTab')
|
||||||
|
.setAttribute('disabled', !this.canOpenLinkInSplitView());
|
||||||
|
}
|
||||||
|
|
||||||
|
canOpenLinkInSplitView() {
|
||||||
|
const currentView = this.currentView;
|
||||||
|
if (currentView < 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const group = this._data[currentView];
|
||||||
|
if (!group || group.tabs.length >= this.MAX_TABS) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.gZenViewSplitter = new ZenViewSplitter();
|
window.gZenViewSplitter = new ZenViewSplitter();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue