mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-02 16:08:41 +00:00
feat: Disable opening link on split view if the limit is reached, b=(no-bug), c=common, split-view
This commit is contained in:
@@ -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();
|
||||||
|
Reference in New Issue
Block a user