feat: Disable opening link on split view if the limit is reached, b=(no-bug), c=common, split-view

This commit is contained in:
Mr. M 2025-05-27 17:14:10 +02:00
parent 4d27f9d741
commit b8213569e5
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
2 changed files with 21 additions and 1 deletions

View file

@ -87,7 +87,7 @@
}
async #waitAndCleanup() {
await SessionStore.promiseInitialized;
await SessionStore.promiseAllWindowsRestored;
await this.#resolveGlanceTabs();
this.#cleanup();
}

View file

@ -1151,6 +1151,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
this.tabBrowserPanel.removeAttribute('zen-split-view');
this.currentView = -1;
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);
}
}
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();