mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-28 10:14:12 +00:00
fix: Fixed restoring folders from saved SQL backup database, b=no-bug, c=common, folders, tabs, workspaces
This commit is contained in:
@@ -69,7 +69,7 @@ body > #confetti {
|
||||
}
|
||||
|
||||
& #PanelUI-zen-emojis-picker-change-svg {
|
||||
background: transparent !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
& #PanelUI-zen-emojis-picker-pages > vbox[emojis='true'] {
|
||||
@@ -90,6 +90,10 @@ body > #confetti {
|
||||
padding: 6px 16px;
|
||||
justify-content: space-between;
|
||||
|
||||
& > toolbarbutton:first-of-type {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
& #PanelUI-zen-emojis-buttons-wrapper {
|
||||
gap: 4px;
|
||||
|
||||
|
||||
@@ -522,7 +522,11 @@
|
||||
folder.setAttribute('zen-pin-id', options.initialPinId);
|
||||
}
|
||||
|
||||
insertBefore.before(folder);
|
||||
if (options.insertAfter) {
|
||||
options.insertAfter.after(folder);
|
||||
} else {
|
||||
insertBefore.before(folder);
|
||||
}
|
||||
gZenVerticalTabsManager.animateItemOpen(folder);
|
||||
|
||||
folder.addTabs(tabs);
|
||||
@@ -837,7 +841,6 @@
|
||||
} else {
|
||||
svgIcon.style.opacity = '1';
|
||||
}
|
||||
svgIcon.setAttribute('transform', 'translate(-52.5, 2.5)');
|
||||
}
|
||||
|
||||
collapseVisibleTab(group) {
|
||||
|
||||
@@ -263,6 +263,7 @@ zen-folder {
|
||||
fill-opacity: 0.9;
|
||||
-moz-context-properties: fill, fill-opacity;
|
||||
fill: var(--zen-folder-stroke);
|
||||
transform: translate(-180%, 10%);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@
|
||||
collapsed: pin.isFolderCollapsed,
|
||||
initialPinId: pin.uuid,
|
||||
workspaceId: pin.workspaceUuid,
|
||||
insertBefore:
|
||||
insertAfter:
|
||||
groups.get(pin.parentUuid)?.querySelector('.tab-group-container')?.lastChild ||
|
||||
null,
|
||||
});
|
||||
@@ -323,8 +323,6 @@
|
||||
|
||||
this.log(`Created new pinned tab for pin ${pin.uuid} (isEssential: ${pin.isEssential})`);
|
||||
gBrowser.pinTab(newTab);
|
||||
gBrowser.tabContainer._invalidateCachedTabs();
|
||||
newTab.initialize();
|
||||
|
||||
if (pin.parentUuid) {
|
||||
const parentGroup = groups.get(pin.parentUuid);
|
||||
@@ -343,6 +341,9 @@
|
||||
gZenWorkspaces.getEssentialsSection(pin.containerTabId).appendChild(newTab);
|
||||
}
|
||||
}
|
||||
|
||||
gBrowser.tabContainer._invalidateCachedTabs();
|
||||
newTab.initialize();
|
||||
} catch (ex) {
|
||||
console.error('Failed to initialize pinned tabs:', ex);
|
||||
}
|
||||
@@ -432,7 +433,7 @@
|
||||
if (!tabPin) {
|
||||
return;
|
||||
}
|
||||
ZenPinnedTabsStorage.addTabToGroup(tabPinId, pinId, /* position */ tab._tPos);
|
||||
ZenPinnedTabsStorage.addTabToGroup(tabPinId, pinId, /* position */ tab._pPos);
|
||||
}
|
||||
|
||||
async #onTabUngrouped(event) {
|
||||
@@ -446,7 +447,7 @@
|
||||
if (!tabPin) {
|
||||
return;
|
||||
}
|
||||
ZenPinnedTabsStorage.removeTabFromGroup(tabPinId, /* position */ tab._tPos);
|
||||
ZenPinnedTabsStorage.removeTabFromGroup(tabPinId, /* position */ tab._pPos);
|
||||
}
|
||||
|
||||
async #updateGroupInfo(group) {
|
||||
@@ -496,7 +497,7 @@
|
||||
if (tab.pinned && tab.getAttribute('zen-pin-id') === pinId) {
|
||||
const pin = this._pinsCache.find((p) => p.uuid === pinId);
|
||||
if (pin) {
|
||||
pin.position = tab._tPos;
|
||||
pin.position = tab._pPos;
|
||||
await this.savePin(pin, false);
|
||||
}
|
||||
break;
|
||||
@@ -515,7 +516,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
for (let otherTab of [...gBrowser.tabs, ...gBrowser.tabGroups]) {
|
||||
const allTabs = [...gBrowser.tabs, ...gBrowser.tabGroups];
|
||||
for (let i = 0; i < allTabs.length; i++) {
|
||||
const otherTab = allTabs[i];
|
||||
if (
|
||||
otherTab.pinned &&
|
||||
otherTab.getAttribute('zen-pin-id') !== tab.getAttribute('zen-pin-id')
|
||||
@@ -526,7 +529,7 @@
|
||||
if (!actualPin) {
|
||||
continue;
|
||||
}
|
||||
actualPin.position = otherTab._tPos;
|
||||
actualPin.position = otherTab._pPos;
|
||||
actualPin.workspaceUuid = otherTab.getAttribute('zen-workspace-id');
|
||||
actualPin.parentUuid = otherTab.group?.getAttribute('zen-pin-id') || null;
|
||||
await this.savePin(actualPin, false);
|
||||
@@ -538,7 +541,7 @@
|
||||
if (!actualPin) {
|
||||
return;
|
||||
}
|
||||
actualPin.position = tab._tPos;
|
||||
actualPin.position = tab._pPos;
|
||||
actualPin.isEssential = tab.hasAttribute('zen-essential');
|
||||
actualPin.parentUuid = tab.group?.getAttribute('zen-pin-id') || null;
|
||||
actualPin.workspaceUuid = tab.getAttribute('zen-workspace-id') || null;
|
||||
|
||||
@@ -1602,19 +1602,23 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
||||
// Fix tabs _tPos values relative to the actual order
|
||||
const tabs = gBrowser.tabs;
|
||||
const usedGroups = new Set();
|
||||
let i = 0;
|
||||
let tPos = 0; // _tPos is used for the session store, not needed for folders
|
||||
let pPos = 0; // _pPos is used for the pinned tabs manager
|
||||
const recurseFolder = (tab) => {
|
||||
if (tab.group) {
|
||||
recurseFolder(tab.group);
|
||||
if (!usedGroups.has(tab.group.id)) {
|
||||
usedGroups.add(tab.group.id);
|
||||
tab.group._tPos = i++;
|
||||
tab.group._pPos = pPos++;
|
||||
}
|
||||
}
|
||||
};
|
||||
for (const tab of tabs) {
|
||||
recurseFolder(tab);
|
||||
tab._tPos = i++;
|
||||
tab._tPos = tPos++;
|
||||
if (!tab.hasAttribute('zen-empty-tab')) {
|
||||
tab._pPos = pPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user