mirror of
https://github.com/zen-browser/desktop.git
synced 2026-03-30 04:11:51 +00:00
fix: Fixed selecting split views with 2 windows turning them to blank tabs, b=no-bug, c=split-view, tabs
This commit is contained in:
@@ -14,9 +14,6 @@
|
||||
- name: zen.tabs.essentials.max
|
||||
value: 12
|
||||
|
||||
- name: zen.tabs.essentials.dnd-promo-enabled
|
||||
value: true
|
||||
|
||||
- name: zen.tabs.show-newtab-vertical
|
||||
value: true
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
index 2a055f0c5f34f0a2667f659185120c07d38f4e41..27f85dc47d66f2f83820e964198832d82bff04c1 100644
|
||||
index 2a055f0c5f34f0a2667f659185120c07d38f4e41..c0ab92bfc89306e4e7d3a43097beb2dc5c9189be 100644
|
||||
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
@@ -127,6 +127,9 @@ const TAB_EVENTS = [
|
||||
@@ -219,8 +219,8 @@ index 2a055f0c5f34f0a2667f659185120c07d38f4e41..27f85dc47d66f2f83820e964198832d8
|
||||
+ aWindow.document.documentElement.setAttribute("zen-unsynced-window", "true");
|
||||
+ }
|
||||
+ aWindow.gZenFolders?.restoreDataFromSessionStore(winData.folders);
|
||||
+ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData);
|
||||
+ aWindow.gZenWorkspaces?.restoreWorkspacesFromSessionStore(winData);
|
||||
+ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData);
|
||||
|
||||
// Move the originally open tabs to the end.
|
||||
if (initialTabs) {
|
||||
|
||||
@@ -864,9 +864,8 @@
|
||||
if (event.target.classList.contains("zen-workspace-empty-space")) {
|
||||
dropElement = this._tabbrowserTabs.ariaFocusableItems.at(-1);
|
||||
// Only if there are no normal tabs to drop after
|
||||
showIndicatorUnderNewTabButton = !tabs.some(
|
||||
(tab) => !(tab.group || tab).pinned || tab.hasAttribute("zen-essential")
|
||||
);
|
||||
showIndicatorUnderNewTabButton =
|
||||
gBrowser.tabs[gBrowser.tabs.length - 1].hasAttribute("zen-empty-tab");
|
||||
} else {
|
||||
const numEssentials = gBrowser._numZenEssentials;
|
||||
const numPinned = gBrowser.pinnedTabCount - numEssentials;
|
||||
|
||||
@@ -802,7 +802,11 @@ class nsZenWindowSync {
|
||||
if (aWindow.gBrowser.selectedTab === this.#lastSelectedTab && !ignoreSameTab) {
|
||||
return;
|
||||
}
|
||||
if (aPreviousTab?._zenContentsVisible) {
|
||||
let activeBrowsers = aWindow.gBrowser.selectedBrowsers;
|
||||
let activeTabs = activeBrowsers.map((browser) => aWindow.gBrowser.getTabForBrowser(browser));
|
||||
// Ignore previous tabs that are still "active". These scenarios could happen for example,
|
||||
// when selecting on a split view tab that was already active.
|
||||
if (aPreviousTab?._zenContentsVisible && !activeTabs.includes(aPreviousTab)) {
|
||||
const otherTabToShow = this.#getActiveTabFromOtherWindows(
|
||||
aWindow,
|
||||
aPreviousTab.id,
|
||||
@@ -815,8 +819,7 @@ class nsZenWindowSync {
|
||||
}
|
||||
}
|
||||
let promises = [];
|
||||
for (const browserView of aWindow.gBrowser.selectedBrowsers) {
|
||||
const selectedTab = aWindow.gBrowser.getTabForBrowser(browserView);
|
||||
for (const selectedTab of activeTabs) {
|
||||
if (selectedTab._zenContentsVisible || selectedTab.hasAttribute("zen-empty-tab")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2023,24 +2023,15 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
return;
|
||||
}
|
||||
this._sessionRestoring = true;
|
||||
let groups = [];
|
||||
// We can just get the tab group with document.getElementById(group.groupId)
|
||||
// and add the tabs to it
|
||||
for (const group of data) {
|
||||
const groupElement = document.getElementById(group.groupId);
|
||||
if (groupElement) {
|
||||
const tabs = groupElement.tabs;
|
||||
groups.push(groupElement);
|
||||
this.splitTabs(tabs, group.gridType);
|
||||
}
|
||||
}
|
||||
// See https://github.com/zen-browser/desktop/issues/11887, some groups
|
||||
// may end up empty after restoring, so we need to remove them
|
||||
for (const groupElement of groups) {
|
||||
if (groupElement.tabs.length === 0) {
|
||||
groupElement.remove();
|
||||
}
|
||||
}
|
||||
delete this._sessionRestoring;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ class nsZenEssentialsPromo extends MozXULElement {
|
||||
* "exists" if the promo already exists, or false if the section is not empty.
|
||||
*/
|
||||
export function createZenEssentialsPromo(container = undefined) {
|
||||
if (!Services.prefs.getBoolPref("zen.tabs.essentials.dnd-promo-enabled", true)) {
|
||||
return false;
|
||||
}
|
||||
if (container === undefined) {
|
||||
container = gZenWorkspaces.getCurrentSpaceContainerId();
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ zen-essentials-promo {
|
||||
margin: 2px;
|
||||
text-align: center;
|
||||
box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
transition:
|
||||
background 0.1s,
|
||||
outline 0.1s;
|
||||
transition: background 0.1s;
|
||||
|
||||
&:not([dragover="true"]) {
|
||||
background: color-mix(in srgb, var(--zen-primary-color) 60%, transparent);
|
||||
|
||||
@@ -1349,4 +1349,8 @@
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
background: var(--zen-primary-color);
|
||||
|
||||
:root[zen-right-side="true"] & {
|
||||
left: calc(-1 * var(--zen-toolbox-padding));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user