mirror of
https://github.com/zen-browser/desktop.git
synced 2026-05-20 20:04:19 +00:00
gh-13390: Fixed splitting out a single tab ending up non-functional (gh-13419)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
|
||||
index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..3ac8d2facb224ae39d2199f2c5ec08b77e0c1dfd 100644
|
||||
index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..139fa9be7919928e5a57fda6c7fabe4bc5acf982 100644
|
||||
--- a/browser/components/tabbrowser/content/tab.js
|
||||
+++ b/browser/components/tabbrowser/content/tab.js
|
||||
@@ -21,6 +21,7 @@
|
||||
@@ -151,17 +151,24 @@ index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..3ac8d2facb224ae39d2199f2c5ec08b7
|
||||
on_click(event) {
|
||||
if (event.button != 0) {
|
||||
return;
|
||||
@@ -617,14 +656,23 @@
|
||||
@@ -617,14 +656,30 @@
|
||||
trigger: "alt_click",
|
||||
});
|
||||
}
|
||||
+ if (
|
||||
+ !event.target.classList.contains("tab-close-button") &&
|
||||
+ !event.target.classList.contains("tab-icon-overlay") &&
|
||||
+ !event.target.classList.contains("tab-audio-button") &&
|
||||
+ !this.splitView
|
||||
+ !event.target.classList.contains("tab-audio-button")
|
||||
+ ) {
|
||||
+ gZenViewSplitter.contextSplitTabs(this);
|
||||
+ if (!this.splitView) {
|
||||
+ gZenViewSplitter.contextSplitTabs(this);
|
||||
+ } else {
|
||||
+ gBrowser.selectedTab = this;
|
||||
+ gZenViewSplitter.removeTabFromGroup(this, undefined, {
|
||||
+ forUnsplit: true,
|
||||
+ changeTab: false
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
@@ -176,7 +183,7 @@ index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..3ac8d2facb224ae39d2199f2c5ec08b7
|
||||
gBrowser.multiSelectedTabsCount > 0 &&
|
||||
!event.target.classList.contains("tab-close-button") &&
|
||||
!event.target.classList.contains("tab-icon-overlay") &&
|
||||
@@ -636,8 +684,9 @@
|
||||
@@ -636,8 +691,9 @@
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -188,7 +195,7 @@ index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..3ac8d2facb224ae39d2199f2c5ec08b7
|
||||
) {
|
||||
if (this.activeMediaBlocked) {
|
||||
if (this.multiselected) {
|
||||
@@ -655,7 +704,7 @@
|
||||
@@ -655,7 +711,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,7 +204,7 @@ index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..3ac8d2facb224ae39d2199f2c5ec08b7
|
||||
if (this.multiselected) {
|
||||
gBrowser.removeMultiSelectedTabs(
|
||||
lazy.TabMetrics.userTriggeredContext(
|
||||
@@ -675,6 +724,14 @@
|
||||
@@ -675,6 +731,14 @@
|
||||
// (see tabbrowser-tabs 'click' handler).
|
||||
gBrowser.tabContainer._blockDblClick = true;
|
||||
}
|
||||
@@ -212,7 +219,7 @@ index 2e02bad1a7c89b4c3b5aee1e14c13bb953a64eb6..3ac8d2facb224ae39d2199f2c5ec08b7
|
||||
}
|
||||
|
||||
on_dblclick(event) {
|
||||
@@ -698,6 +755,8 @@
|
||||
@@ -698,6 +762,8 @@
|
||||
animate: true,
|
||||
triggeringEvent: event,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..d16fe62c8a67913dd1499b2665a22ff606d98f1e 100644
|
||||
index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..5610ba246519c5169395be211b192b5a1765f63b 100644
|
||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
@@ -413,6 +413,7 @@
|
||||
@@ -1103,11 +1103,12 @@ index 2643e1a2aa14ba5cb4a64a92e1c2dfa5f07d242f..d16fe62c8a67913dd1499b2665a22ff6
|
||||
}
|
||||
|
||||
let userContextId = this.mBrowser.getAttribute("usercontextid") || 0;
|
||||
@@ -10450,7 +10698,7 @@ var TabContextMenu = {
|
||||
@@ -10450,7 +10698,8 @@ var TabContextMenu = {
|
||||
);
|
||||
contextUnpinSelectedTabs.hidden =
|
||||
!this.contextTab.pinned || !this.multiselected;
|
||||
-
|
||||
+ gZenViewSplitter.updateContextMenuItems();
|
||||
+ gZenPinnedTabManager.updatePinnedTabContextMenu(this.contextTab);
|
||||
// Build Ask Chat items
|
||||
TabContextMenu.GenAI.buildTabMenu(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarView.sys.mjs b/browser/components/urlbar/UrlbarView.sys.mjs
|
||||
index b665adb1a1ce8bbae8df4cbea6c3248c3e4fb431..7a73907957d38caba5b650749abf80a01b51559d 100644
|
||||
index b665adb1a1ce8bbae8df4cbea6c3248c3e4fb431..1de7f9461b8ccbd4680b917e6dd5ba3c02f69a94 100644
|
||||
--- a/browser/components/urlbar/UrlbarView.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarView.sys.mjs
|
||||
@@ -640,7 +640,7 @@ export class UrlbarView {
|
||||
@@ -11,7 +11,18 @@ index b665adb1a1ce8bbae8df4cbea6c3248c3e4fb431..7a73907957d38caba5b650749abf80a0
|
||||
// Try to reuse the cached top-sites context. If it's not cached, then
|
||||
// there will be a gap of time between when the input is focused and
|
||||
// when the view opens that can be perceived as flicker.
|
||||
@@ -2988,6 +2988,8 @@ export class UrlbarView {
|
||||
@@ -777,10 +777,6 @@ export class UrlbarView {
|
||||
}
|
||||
|
||||
// If search mode isn't active, close the view.
|
||||
- if (!this.input.searchMode) {
|
||||
- this.close();
|
||||
- return;
|
||||
- }
|
||||
|
||||
// Search mode is active. If the one-offs should be shown, make sure they
|
||||
// are enabled and show the view.
|
||||
@@ -2988,6 +2984,8 @@ export class UrlbarView {
|
||||
if (row?.hasAttribute("row-selectable")) {
|
||||
row?.toggleAttribute("selected", true);
|
||||
}
|
||||
@@ -20,7 +31,7 @@ index b665adb1a1ce8bbae8df4cbea6c3248c3e4fb431..7a73907957d38caba5b650749abf80a0
|
||||
if (element != row) {
|
||||
row?.toggleAttribute("descendant-selected", true);
|
||||
}
|
||||
@@ -3477,7 +3479,7 @@ export class UrlbarView {
|
||||
@@ -3477,7 +3475,7 @@ export class UrlbarView {
|
||||
}
|
||||
|
||||
#enableOrDisableRowWrap() {
|
||||
|
||||
@@ -117,7 +117,6 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
);
|
||||
window.addEventListener("TabSelect", this.onTabSelect.bind(this));
|
||||
this.initializeContextMenu();
|
||||
this.insertIntoContextMenu();
|
||||
|
||||
window.addEventListener(
|
||||
"AfterWorkspacesSessionRestore",
|
||||
@@ -1163,33 +1162,27 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
/**
|
||||
* context menu item display update
|
||||
*/
|
||||
insetUpdateContextMenuItems() {
|
||||
const contentAreaContextMenu = document.getElementById("tabContextMenu");
|
||||
contentAreaContextMenu.addEventListener("popupshowing", () => {
|
||||
let contextTab = TabContextMenu.contextTab;
|
||||
if (!contextTab) {
|
||||
return;
|
||||
}
|
||||
let selectedTabs = contextTab.multiselected
|
||||
? gBrowser.selectedTabs
|
||||
: [contextTab];
|
||||
let isExistingSplitView = selectedTabs.every(tab =>
|
||||
tab.group?.hasAttribute("split-view-group")
|
||||
);
|
||||
const splitTabCommand = document.getElementById("context_zenSplitTabs");
|
||||
document.l10n.setAttributes(splitTabCommand, "tab-zen-split-tabs", {
|
||||
tabCount: isExistingSplitView ? -1 : selectedTabs.length,
|
||||
});
|
||||
if (isExistingSplitView) {
|
||||
splitTabCommand.removeAttribute("hidden");
|
||||
return;
|
||||
}
|
||||
if (!this.contextCanSplitTabs()) {
|
||||
splitTabCommand.setAttribute("hidden", "true");
|
||||
} else {
|
||||
splitTabCommand.removeAttribute("hidden");
|
||||
}
|
||||
updateContextMenuItems() {
|
||||
let contextTab = TabContextMenu.contextTab;
|
||||
let selectedTabs = contextTab.multiselected
|
||||
? gBrowser.selectedTabs
|
||||
: [contextTab];
|
||||
let isExistingSplitView = selectedTabs.every(tab =>
|
||||
tab.group?.hasAttribute("split-view-group")
|
||||
);
|
||||
const splitTabCommand = document.getElementById("context_zenSplitTabs");
|
||||
document.l10n.setAttributes(splitTabCommand, "tab-zen-split-tabs", {
|
||||
tabCount: isExistingSplitView ? -1 : selectedTabs.length,
|
||||
});
|
||||
if (isExistingSplitView) {
|
||||
splitTabCommand.removeAttribute("hidden");
|
||||
return;
|
||||
}
|
||||
if (!this.contextCanSplitTabs()) {
|
||||
splitTabCommand.setAttribute("hidden", "true");
|
||||
} else {
|
||||
splitTabCommand.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1210,7 +1203,7 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
*/
|
||||
initializeContextMenu() {
|
||||
this.insertSplitViewTabContextMenu();
|
||||
this.insetUpdateContextMenuItems();
|
||||
this.insertIntoContextMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1252,7 +1245,7 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
let currentTab = TabContextMenu.contextTab || gBrowser.selectedTab;
|
||||
if (currentTab.multiselected) {
|
||||
tabs = gBrowser.selectedTabs;
|
||||
} else if (!currentTab.selected) {
|
||||
} else if (!currentTab.selected && !currentTab.splitView) {
|
||||
tabs = [
|
||||
currentTab,
|
||||
...gBrowser.selectedTabs.filter(t => t !== currentTab),
|
||||
@@ -1263,11 +1256,6 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
if (otherTabHint && !tabs.includes(otherTabHint)) {
|
||||
tabs.push(otherTabHint);
|
||||
}
|
||||
if (tabs.length < 2) {
|
||||
gBrowser.selectedTab = tabs[0];
|
||||
this.createEmptySplit();
|
||||
return;
|
||||
}
|
||||
// If all are already in a split view, we unsplit them first.
|
||||
if (tabs.every(tab => tab.splitView)) {
|
||||
for (const tab of tabs) {
|
||||
@@ -1277,6 +1265,11 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (tabs.length < 2) {
|
||||
gBrowser.selectedTab = tabs[0];
|
||||
this.createEmptySplit();
|
||||
return;
|
||||
}
|
||||
this.splitTabs(tabs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user