mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 17:36:34 +00:00
Worked a bit more on split view groups
This commit is contained in:
@@ -37,6 +37,12 @@ tab-group[split-view-group] {
|
|||||||
& .tab-close-button {
|
& .tab-close-button {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
#tabbrowser-tabs[movingtab] & {
|
||||||
|
transition: var(--tab-dragover-transition);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tab-group[split-view-group] .tabbrowser-tab {
|
tab-group[split-view-group] .tabbrowser-tab {
|
||||||
|
@@ -19,6 +19,12 @@
|
|||||||
#onTabUngrouped(event) {}
|
#onTabUngrouped(event) {}
|
||||||
|
|
||||||
#onTabGroupRemoved(event) {}
|
#onTabGroupRemoved(event) {}
|
||||||
|
|
||||||
|
expandGroupTabs(group) {
|
||||||
|
for (const tab of group.tabs) {
|
||||||
|
gBrowser.ungroupTab(tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.gZenFolders = new ZenFolders();
|
window.gZenFolders = new ZenFolders();
|
||||||
|
@@ -565,6 +565,8 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||||||
* @param {number} groupIndex - The index of the group to remove.
|
* @param {number} groupIndex - The index of the group to remove.
|
||||||
*/
|
*/
|
||||||
removeGroup(groupIndex) {
|
removeGroup(groupIndex) {
|
||||||
|
const group = this._data[groupIndex];
|
||||||
|
gZenFolders.expandGroupTabs(group);
|
||||||
if (this.currentView === groupIndex) {
|
if (this.currentView === groupIndex) {
|
||||||
this.deactivateCurrentSplitView();
|
this.deactivateCurrentSplitView();
|
||||||
}
|
}
|
||||||
@@ -721,7 +723,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||||||
} else {
|
} else {
|
||||||
// Add any tabs that are not already in the group
|
// Add any tabs that are not already in the group
|
||||||
for (const tab of tabs) {
|
for (const tab of tabs) {
|
||||||
if (!group.tabs.includes(tab)) {
|
if (!group.tabs.includes(tab) && tab.pinned === group.pinned) {
|
||||||
group.tabs.push(tab);
|
group.tabs.push(tab);
|
||||||
this.addTabToSplit(tab, group.layoutTree);
|
this.addTabToSplit(tab, group.layoutTree);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c159b62f28d 100644
|
index 628aa6596627c85efe361fc1ece8fd58f7ee653e..a1500038ff8f129fc249a221c2b534c8b2edf053 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
@@ -412,11 +412,50 @@
|
@@ -412,11 +412,50 @@
|
||||||
@@ -441,21 +441,28 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
} else {
|
} else {
|
||||||
aIndex = Math.max(aIndex, this.pinnedTabCount);
|
aIndex = Math.max(aIndex, this.pinnedTabCount);
|
||||||
}
|
}
|
||||||
@@ -5684,9 +5797,11 @@
|
@@ -5684,11 +5797,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this._handleTabMove(aTab, () => {
|
this._handleTabMove(aTab, () => {
|
||||||
- let neighbor = this.tabs[aIndex];
|
- let neighbor = this.tabs[aIndex];
|
||||||
- if (forceStandaloneTab && neighbor.group) {
|
- if (forceStandaloneTab && neighbor.group) {
|
||||||
+ let neighbor = this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab"))[aIndex];
|
+ let neighbor = this.tabs.filter(tab => !tab.hasAttribute("zen-glance-tab"))[aIndex];
|
||||||
+ if (forceStandaloneTab && neighbor.group || (neighbor.group && neighbor.group.hasAttribute("split-view-group"))) {
|
+ const _tPos = aTab._tPos;
|
||||||
|
+ if ((forceStandaloneTab && neighbor.group) || neighbor.group?.hasAttribute("split-view-group")) {
|
||||||
neighbor = neighbor.group;
|
neighbor = neighbor.group;
|
||||||
+ } else if (aTab.group && aTab.group.hasAttribute("split-view-group")) {
|
+ } else if (aTab.group && aTab.group.hasAttribute("split-view-group")) {
|
||||||
+ aTab = aTab.group;
|
+ aTab = aTab.group;
|
||||||
|
+ }
|
||||||
|
+ if (aTab.group?.hasAttribute("split-view-group") && neighbor == aTab.group) {
|
||||||
|
+ return;
|
||||||
}
|
}
|
||||||
if (neighbor && aIndex >= aTab._tPos) {
|
- if (neighbor && aIndex >= aTab._tPos) {
|
||||||
|
+ if (neighbor && aIndex >= _tPos) {
|
||||||
neighbor.after(aTab);
|
neighbor.after(aTab);
|
||||||
@@ -5697,7 +5812,7 @@
|
} else {
|
||||||
|
this.tabContainer.insertBefore(aTab, neighbor);
|
||||||
|
@@ -5697,7 +5816,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
moveTabToGroup(aTab, aGroup) {
|
moveTabToGroup(aTab, aGroup) {
|
||||||
@@ -464,7 +471,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (aTab.group && aTab.group.id === aGroup.id) {
|
if (aTab.group && aTab.group.id === aGroup.id) {
|
||||||
@@ -5721,6 +5836,8 @@
|
@@ -5721,6 +5840,8 @@
|
||||||
|
|
||||||
moveActionCallback();
|
moveActionCallback();
|
||||||
|
|
||||||
@@ -473,7 +480,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
// Clear tabs cache after moving nodes because the order of tabs may have
|
// Clear tabs cache after moving nodes because the order of tabs may have
|
||||||
// changed.
|
// changed.
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
@@ -5771,7 +5888,7 @@
|
@@ -5771,7 +5892,7 @@
|
||||||
createLazyBrowser,
|
createLazyBrowser,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -482,7 +489,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
||||||
params.pinned = true;
|
params.pinned = true;
|
||||||
}
|
}
|
||||||
@@ -7415,6 +7532,7 @@
|
@@ -7415,6 +7536,7 @@
|
||||||
aWebProgress.isTopLevel
|
aWebProgress.isTopLevel
|
||||||
) {
|
) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
@@ -490,7 +497,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||||
}
|
}
|
||||||
@@ -8381,7 +8499,7 @@ var TabContextMenu = {
|
@@ -8381,7 +8503,7 @@ var TabContextMenu = {
|
||||||
);
|
);
|
||||||
contextUnpinSelectedTabs.hidden =
|
contextUnpinSelectedTabs.hidden =
|
||||||
!this.contextTab.pinned || !multiselectionContext;
|
!this.contextTab.pinned || !multiselectionContext;
|
||||||
@@ -499,7 +506,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
// Move Tab items
|
// Move Tab items
|
||||||
let contextMoveTabOptions = document.getElementById(
|
let contextMoveTabOptions = document.getElementById(
|
||||||
"context_moveTabOptions"
|
"context_moveTabOptions"
|
||||||
@@ -8414,7 +8532,7 @@ var TabContextMenu = {
|
@@ -8414,7 +8536,7 @@ var TabContextMenu = {
|
||||||
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
||||||
let isFirstTab =
|
let isFirstTab =
|
||||||
tabsToMove[0] == visibleTabs[0] ||
|
tabsToMove[0] == visibleTabs[0] ||
|
||||||
@@ -508,7 +515,7 @@ index 628aa6596627c85efe361fc1ece8fd58f7ee653e..59c563683fc18972fffd51c41d1d1c15
|
|||||||
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
||||||
|
|
||||||
document.getElementById("context_openTabInWindow").disabled =
|
document.getElementById("context_openTabInWindow").disabled =
|
||||||
@@ -8647,6 +8765,7 @@ var TabContextMenu = {
|
@@ -8647,6 +8769,7 @@ var TabContextMenu = {
|
||||||
if (this.contextTab.multiselected) {
|
if (this.contextTab.multiselected) {
|
||||||
gBrowser.removeMultiSelectedTabs();
|
gBrowser.removeMultiSelectedTabs();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
||||||
index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de88446bab 100644
|
index fa96568d366fd3608f9bd583fa793150bd815c8b..03a525205457f723e204614834e32e7a917f41f7 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabs.js
|
--- a/browser/components/tabbrowser/content/tabs.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabs.js
|
+++ b/browser/components/tabbrowser/content/tabs.js
|
||||||
@@ -94,7 +94,7 @@
|
@@ -94,7 +94,7 @@
|
||||||
@@ -328,15 +328,16 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
let absPositionHorizontalTabs =
|
let absPositionHorizontalTabs =
|
||||||
this.overflowing && tabs.length > numPinned && numPinned > 0;
|
this.overflowing && tabs.length > numPinned && numPinned > 0;
|
||||||
|
|
||||||
@@ -2042,6 +2078,7 @@
|
@@ -2041,7 +2077,7 @@
|
||||||
|
|
||||||
if (this.verticalMode) {
|
if (this.verticalMode) {
|
||||||
this._updateVerticalPinnedTabs();
|
this._updateVerticalPinnedTabs();
|
||||||
} else if (absPositionHorizontalTabs) {
|
- } else if (absPositionHorizontalTabs) {
|
||||||
+ return;
|
+ } else if (absPositionHorizontalTabs && false) {
|
||||||
let layoutData = this._pinnedTabsLayoutCache;
|
let layoutData = this._pinnedTabsLayoutCache;
|
||||||
let uiDensity = document.documentElement.getAttribute("uidensity");
|
let uiDensity = document.documentElement.getAttribute("uidensity");
|
||||||
if (!layoutData || layoutData.uiDensity != uiDensity) {
|
if (!layoutData || layoutData.uiDensity != uiDensity) {
|
||||||
@@ -2113,7 +2150,7 @@
|
@@ -2113,7 +2149,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +346,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
|
|
||||||
let directionX = screenX > dragData.animLastScreenX;
|
let directionX = screenX > dragData.animLastScreenX;
|
||||||
let directionY = screenY > dragData.animLastScreenY;
|
let directionY = screenY > dragData.animLastScreenY;
|
||||||
@@ -2296,10 +2333,11 @@
|
@@ -2296,10 +2332,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let pinned = draggedTab.pinned;
|
let pinned = draggedTab.pinned;
|
||||||
@@ -361,7 +362,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (this.#rtlMode) {
|
if (this.#rtlMode) {
|
||||||
@@ -2347,8 +2385,12 @@
|
@@ -2347,8 +2384,12 @@
|
||||||
(lastMovingTabScreen + tabSize);
|
(lastMovingTabScreen + tabSize);
|
||||||
translate = Math.min(Math.max(translate, firstBound), lastBound);
|
translate = Math.min(Math.max(translate, firstBound), lastBound);
|
||||||
|
|
||||||
@@ -376,7 +377,25 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
}
|
}
|
||||||
|
|
||||||
dragData.translatePos = translate;
|
dragData.translatePos = translate;
|
||||||
@@ -2541,8 +2583,9 @@
|
@@ -2484,12 +2525,16 @@
|
||||||
|
// Shift background tabs to leave a gap where the dragged tab
|
||||||
|
// would currently be dropped.
|
||||||
|
for (let tab of tabs) {
|
||||||
|
- if (tab == draggedTab) {
|
||||||
|
+ if (tab == draggedTab || (tab.group?.hasAttribute("split-view-group") && tab.group == draggedTab.group)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let shift = getTabShift(tab, newIndex);
|
||||||
|
let transform = shift ? `${translateAxis}(${shift}px)` : "";
|
||||||
|
+ if (tab.group?.hasAttribute("split-view-group")) {
|
||||||
|
+ tab.group.style.transform = transform;
|
||||||
|
+ } else {
|
||||||
|
tab.style.transform = transform;
|
||||||
|
+ }
|
||||||
|
if (tab.group?.tabs[0] == tab) {
|
||||||
|
tab.group.style.setProperty(
|
||||||
|
"--tabgroup-dragover-transform",
|
||||||
|
@@ -2541,8 +2586,9 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,7 +407,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2553,6 +2596,7 @@
|
@@ -2553,6 +2599,7 @@
|
||||||
tab.style.transform = "";
|
tab.style.transform = "";
|
||||||
if (tab.group) {
|
if (tab.group) {
|
||||||
tab.group.style.removeProperty("--tabgroup-dragover-transform");
|
tab.group.style.removeProperty("--tabgroup-dragover-transform");
|
||||||
@@ -396,7 +415,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
}
|
}
|
||||||
tab.removeAttribute("dragover-createGroup");
|
tab.removeAttribute("dragover-createGroup");
|
||||||
}
|
}
|
||||||
@@ -2604,7 +2648,7 @@
|
@@ -2604,7 +2651,7 @@
|
||||||
movingTab._moveTogetherSelectedTabsData.newIndex = movingTabNewIndex;
|
movingTab._moveTogetherSelectedTabsData.newIndex = movingTabNewIndex;
|
||||||
movingTab._moveTogetherSelectedTabsData.animate = false;
|
movingTab._moveTogetherSelectedTabsData.animate = false;
|
||||||
};
|
};
|
||||||
@@ -405,7 +424,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
postTransitionCleanup();
|
postTransitionCleanup();
|
||||||
} else {
|
} else {
|
||||||
let onTransitionEnd = transitionendEvent => {
|
let onTransitionEnd = transitionendEvent => {
|
||||||
@@ -2707,9 +2751,9 @@
|
@@ -2707,9 +2754,9 @@
|
||||||
function newIndex(aTab, index) {
|
function newIndex(aTab, index) {
|
||||||
// Don't allow mixing pinned and unpinned tabs.
|
// Don't allow mixing pinned and unpinned tabs.
|
||||||
if (aTab.pinned) {
|
if (aTab.pinned) {
|
||||||
@@ -417,7 +436,7 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..2ef63a6b462f28029f02decf14ad93de
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2793,7 +2837,7 @@
|
@@ -2793,7 +2840,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
_notifyBackgroundTab(aTab) {
|
_notifyBackgroundTab(aTab) {
|
||||||
|
Reference in New Issue
Block a user