mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-10 00:55:30 +02:00
fix: improve workspace session restoration and scrolling behavior
This commit is contained in:
parent
a6e03680eb
commit
1473675094
5 changed files with 33 additions and 16 deletions
|
@ -130,6 +130,9 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5ch;
|
gap: 0.5ch;
|
||||||
|
overflow-x: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -981,7 +981,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
layoutTree: this.calculateLayoutTree(tabs, gridType),
|
layoutTree: this.calculateLayoutTree(tabs, gridType),
|
||||||
};
|
};
|
||||||
this._data.push(splitData);
|
this._data.push(splitData);
|
||||||
|
if (!this._sessionRestoring) {
|
||||||
window.gBrowser.selectedTab = tabs[0];
|
window.gBrowser.selectedTab = tabs[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Add tabs to the split view group
|
// Add tabs to the split view group
|
||||||
let splitGroup = this._getSplitViewGroup(tabs);
|
let splitGroup = this._getSplitViewGroup(tabs);
|
||||||
|
@ -1739,6 +1741,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._sessionRestoring = true;
|
||||||
// We can just get the tab group with document.getElementById(group.groupId)
|
// We can just get the tab group with document.getElementById(group.groupId)
|
||||||
// and add the tabs to it
|
// and add the tabs to it
|
||||||
for (const group of data) {
|
for (const group of data) {
|
||||||
|
@ -1748,6 +1751,15 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||||
this.splitTabs([...tabs], group.gridType);
|
this.splitTabs([...tabs], group.gridType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete this._sessionRestoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
onAfterWorkspaceSessionRestore() {
|
||||||
|
if (this.currentView >= 0) {
|
||||||
|
// Activate all browsers in the split view
|
||||||
|
this.currentView = -1;
|
||||||
|
this.onLocationChange(gBrowser.selectedTab.linkedBrowser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -405,6 +405,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
|
|
||||||
_handleSwipeMayStart(event) {
|
_handleSwipeMayStart(event) {
|
||||||
if (!this.workspaceEnabled) return;
|
if (!this.workspaceEnabled) return;
|
||||||
|
if (event.target.closest('#zen-sidebar-bottom-buttons')) return;
|
||||||
|
|
||||||
// Only handle horizontal swipes
|
// Only handle horizontal swipes
|
||||||
if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) {
|
if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) {
|
||||||
|
@ -648,6 +649,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
|
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
|
||||||
BrowserCommands.openTab();
|
BrowserCommands.openTab();
|
||||||
}
|
}
|
||||||
|
gZenViewSplitter.onAfterWorkspaceSessionRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInitialTab(tab, isEmpty) {
|
handleInitialTab(tab, isEmpty) {
|
||||||
|
@ -2415,6 +2417,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
const maxWidth = 100 / numButtons;
|
const maxWidth = 100 / numButtons;
|
||||||
parent.style.setProperty('--zen-overflowed-workspace-button-width', `${maxWidth}%`);
|
parent.style.setProperty('--zen-overflowed-workspace-button-width', `${maxWidth}%`);
|
||||||
this._processingResize = false;
|
this._processingResize = false;
|
||||||
|
|
||||||
|
// Scroll to the active workspace button if it's not visible
|
||||||
|
const activeButton = parent.querySelector('.zen-workspace-button.active');
|
||||||
|
if (!activeButton) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const parentRect = parent.getBoundingClientRect();
|
||||||
|
const activeRect = activeButton.getBoundingClientRect();
|
||||||
|
if (activeRect.left < parentRect.left || activeRect.right > parentRect.right) {
|
||||||
|
parent.scrollLeft = activeButton.offsetLeft;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
index f814772114948f87cbb3c3a7231c95ea1f68d776..ee358a46956d5f09983fa98a202085bac69c8b27 100644
|
index f814772114948f87cbb3c3a7231c95ea1f68d776..38913eb9dee97b42697440560f7a1bab1ffe9f15 100644
|
||||||
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||||
@@ -3171,7 +3171,7 @@ var SessionStoreInternal = {
|
@@ -3171,7 +3171,7 @@ var SessionStoreInternal = {
|
||||||
|
@ -54,17 +54,6 @@ index f814772114948f87cbb3c3a7231c95ea1f68d776..ee358a46956d5f09983fa98a202085ba
|
||||||
this._log.debug(
|
this._log.debug(
|
||||||
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
||||||
);
|
);
|
||||||
@@ -5933,8 +5936,8 @@ var SessionStoreInternal = {
|
|
||||||
let isRemotenessUpdate = options.isRemotenessUpdate;
|
|
||||||
|
|
||||||
let willRestoreImmediately =
|
|
||||||
- options.restoreImmediately || tabbrowser.selectedBrowser == browser;
|
|
||||||
-
|
|
||||||
+ options.restoreImmediately || tabbrowser.selectedBrowser == browser
|
|
||||||
+ || (tabbrowser.selectedTab.group?.id == tab.group?.id);
|
|
||||||
let isBrowserInserted = browser.isConnected;
|
|
||||||
|
|
||||||
// Increase the busy state counter before modifying the tab.
|
|
||||||
@@ -6086,8 +6089,23 @@ var SessionStoreInternal = {
|
@@ -6086,8 +6089,23 @@ var SessionStoreInternal = {
|
||||||
|
|
||||||
// Most of tabData has been restored, now continue with restoring
|
// Most of tabData has been restored, now continue with restoring
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"binaryName": "zen",
|
"binaryName": "zen",
|
||||||
"version": {
|
"version": {
|
||||||
"product": "firefox",
|
"product": "firefox",
|
||||||
"version": "136.0.2",
|
"version": "136.0.3",
|
||||||
"candidate": "136.0.3"
|
"candidate": "136.0.3"
|
||||||
},
|
},
|
||||||
"buildOptions": {
|
"buildOptions": {
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
"brandShortName": "Zen",
|
"brandShortName": "Zen",
|
||||||
"brandFullName": "Zen Browser",
|
"brandFullName": "Zen Browser",
|
||||||
"release": {
|
"release": {
|
||||||
"displayVersion": "1.10.1b",
|
"displayVersion": "1.10.2b",
|
||||||
"github": {
|
"github": {
|
||||||
"repo": "zen-browser/desktop"
|
"repo": "zen-browser/desktop"
|
||||||
},
|
},
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
"brandShortName": "Twilight",
|
"brandShortName": "Twilight",
|
||||||
"brandFullName": "Zen Twilight",
|
"brandFullName": "Zen Twilight",
|
||||||
"release": {
|
"release": {
|
||||||
"displayVersion": "1.10.1t",
|
"displayVersion": "1.10.2t",
|
||||||
"github": {
|
"github": {
|
||||||
"repo": "zen-browser/desktop"
|
"repo": "zen-browser/desktop"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue