fix: Fixed restoring split views inside folders, b=closes #11887, c=compact-mode, kbs, split-view, tabs

This commit is contained in:
mr. m
2026-01-14 18:55:20 +01:00
parent 88e22d953c
commit b6d17b1ff7
6 changed files with 47 additions and 34 deletions

View File

@@ -463,31 +463,27 @@ window.gZenCompactModeManager = {
this.sidebar.removeAttribute("animate");
document.documentElement.removeAttribute("zen-compact-animating");
setTimeout(() => {
this.getAndApplySidebarWidth({});
this._ignoreNextResize = true;
if (this._ignoreNextHover) {
setTimeout(() => {
if (this._ignoreNextHover) {
setTimeout(() => {
delete this._ignoreNextHover;
});
}
this.sidebar.style.removeProperty("margin-right");
this.sidebar.style.removeProperty("margin-left");
this.sidebar.style.removeProperty("transition");
this.sidebar.style.removeProperty("transform");
this.sidebar.style.removeProperty("point-events");
titlebar.style.removeProperty("visibility");
titlebar.style.removeProperty("transition");
gURLBar.style.removeProperty("visibility");
resolve();
delete this._ignoreNextHover;
});
});
}
this.getAndApplySidebarWidth({});
this._ignoreNextResize = true;
this.sidebar.style.removeProperty("margin-right");
this.sidebar.style.removeProperty("margin-left");
this.sidebar.style.removeProperty("transition");
this.sidebar.style.removeProperty("transform");
this.sidebar.style.removeProperty("point-events");
titlebar.style.removeProperty("visibility");
titlebar.style.removeProperty("transition");
gURLBar.style.removeProperty("visibility");
resolve();
});
} else if (canHideSidebar && !isCompactMode) {
// Shouldn't be ever true, but just in case

View File

@@ -978,18 +978,14 @@
let draggedTab = event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
let dragData = draggedTab._dragData;
let movingTabs = dragData.movingTabs;
if (!gZenPinnedTabManager.canEssentialBeAdded(draggedTab)) {
if (
!gZenPinnedTabManager.canEssentialBeAdded(draggedTab) &&
!draggedTab.hasAttribute("zen-essential")
) {
return;
}
let essentialsPromoStatus = this.createZenEssentialsPromo();
this.clearDragOverVisuals();
if (
!draggedTab.hasAttribute("zen-essential") &&
gBrowser._numZenEssentials >= gZenPinnedTabManager.maxEssentialTabs
) {
return;
}
let essentialsPromoStatus = this.createZenEssentialsPromo(draggedTab?.userContextId);
switch (essentialsPromoStatus) {
case "shown":
case "created":

View File

@@ -1060,7 +1060,7 @@ class nsZenKeyboardShortcutsVersioner {
data.push(
new KeyShortcut(
"zen-new-empty-split-view",
AppConstants.platform == "macosx" ? "+" : "*",
"*",
"",
ZEN_SPLIT_VIEW_SHORTCUTS_GROUP,
nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }),
@@ -1102,7 +1102,7 @@ class nsZenKeyboardShortcutsVersioner {
);
}
if (version < 14) {
if (version < 15) {
// Migrate from version 13 to 14
// Add shortcut to open a new unsynced window: Default accelt+option+N (Ctrl+Alt+N on non-macOS)
data.push(
@@ -1116,6 +1116,15 @@ class nsZenKeyboardShortcutsVersioner {
"zen-new-unsynced-window-shortcut"
)
);
// Also, change the default for new empty split from + to * on mac
for (let shortcut of data) {
if (shortcut.getID() == "zen-new-empty-split-view" && AppConstants.platform == "macosx") {
if (shortcut.getKeyName() == "+") {
shortcut.setNewBinding("*");
}
break;
}
}
}
return data;

View File

@@ -2023,15 +2023,24 @@ 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;
}

View File

@@ -15,6 +15,9 @@ 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;
&:not([dragover="true"]) {
background: color-mix(in srgb, var(--zen-primary-color) 60%, transparent);

View File

@@ -1097,7 +1097,7 @@
}
#zen-essentials {
z-index: 1;
z-index: 2;
}
.zen-essentials-container {