mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-11 13:58:23 +00:00
fix: Fixed zen-empty-tab
movement while inserting items into a group (#9948)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f411960db1 100644
|
||||
index d80a66a01002e78a9c65545d08fe786328ddf124..749991884735a1a6d7b1a2c2e1c77f7eae2e5c28 100644
|
||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
@@ -422,15 +422,60 @@
|
||||
@@ -673,7 +673,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
moveBefore = false;
|
||||
} else if (!element.pinned && targetElement && targetElement.pinned) {
|
||||
// If the caller asks to move an unpinned element next to a pinned
|
||||
@@ -6165,14 +6303,29 @@
|
||||
@@ -6165,14 +6303,34 @@
|
||||
// move the tab group right before the first unpinned tab.
|
||||
// 4. Moving a tab group and the first unpinned tab is grouped:
|
||||
// move the tab group right before the first unpinned tab's tab group.
|
||||
@@ -692,11 +692,16 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
+ if (targetElement?.group?.hasAttribute("split-view-group")) {
|
||||
+ targetElement = targetElement.group;
|
||||
+ }
|
||||
+ // When the folder is the last element in the pinned section,
|
||||
+ // targetElement is a tab with the zen-empty-tab attribute.
|
||||
+ // If the movement is from top to bottom, it must be redefined as a folder.
|
||||
+ if (targetElement?.hasAttribute("zen-empty-tab") && !moveBefore) {
|
||||
+ targetElement = targetElement.group;
|
||||
+ if (targetElement?.hasAttribute("zen-empty-tab")) {
|
||||
+ // When the folder is the last element in the pinned section,
|
||||
+ // targetElement is a tab with the zen-empty-tab attribute.
|
||||
+ // If the movement is from top to bottom, it must be redefined as a folder.
|
||||
+ if (!moveBefore) {
|
||||
+ targetElement = targetElement.group;
|
||||
+ } else {
|
||||
+ // Always insert an element after zen-empty-tab to avoid it moving from the first position
|
||||
+ moveBefore = false;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
let getContainer = () =>
|
||||
@@ -704,7 +709,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
element.pinned
|
||||
? this.tabContainer.pinnedTabsContainer
|
||||
: this.tabContainer;
|
||||
@@ -6181,7 +6334,7 @@
|
||||
@@ -6181,7 +6339,7 @@
|
||||
element,
|
||||
() => {
|
||||
if (moveBefore) {
|
||||
@@ -713,7 +718,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
} else if (targetElement) {
|
||||
targetElement.after(element);
|
||||
} else {
|
||||
@@ -6230,7 +6383,7 @@
|
||||
@@ -6230,7 +6388,7 @@
|
||||
if (!this.isTab(aTab)) {
|
||||
throw new Error("Can only move a tab into a tab group");
|
||||
}
|
||||
@@ -722,7 +727,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
return;
|
||||
}
|
||||
if (aTab.group && aTab.group.id === aGroup.id) {
|
||||
@@ -6324,6 +6477,10 @@
|
||||
@@ -6324,6 +6482,10 @@
|
||||
|
||||
moveActionCallback();
|
||||
|
||||
@@ -733,7 +738,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
// Clear tabs cache after moving nodes because the order of tabs may have
|
||||
// changed.
|
||||
this.tabContainer._invalidateCachedTabs();
|
||||
@@ -7221,7 +7378,7 @@
|
||||
@@ -7221,7 +7383,7 @@
|
||||
// preventDefault(). It will still raise the window if appropriate.
|
||||
break;
|
||||
}
|
||||
@@ -742,7 +747,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
window.focus();
|
||||
aEvent.preventDefault();
|
||||
break;
|
||||
@@ -8166,6 +8323,7 @@
|
||||
@@ -8166,6 +8328,7 @@
|
||||
aWebProgress.isTopLevel
|
||||
) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
@@ -750,7 +755,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||
}
|
||||
@@ -9157,7 +9315,7 @@ var TabContextMenu = {
|
||||
@@ -9157,7 +9320,7 @@ var TabContextMenu = {
|
||||
);
|
||||
contextUnpinSelectedTabs.hidden =
|
||||
!this.contextTab.pinned || !this.multiselected;
|
||||
@@ -759,7 +764,7 @@ index d80a66a01002e78a9c65545d08fe786328ddf124..50f4d52090139256b00c7183fe61e6f4
|
||||
// Build Ask Chat items
|
||||
TabContextMenu.GenAI.buildTabMenu(
|
||||
document.getElementById("context_askChat"),
|
||||
@@ -9476,6 +9634,7 @@ var TabContextMenu = {
|
||||
@@ -9476,6 +9639,7 @@ var TabContextMenu = {
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user