mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-06 01:46:35 +00:00
Added support to unsplit tabs when dragging them to the sidebar
This commit is contained in:
@@ -1588,7 +1588,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||||||
this.splitTabs([draggedTab, droppedOnTab], gridType, 1);
|
this.splitTabs([draggedTab, droppedOnTab], gridType, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._maybeRemoveFakeBrowser(false);
|
window.requestAnimationFrame(() => {
|
||||||
|
this._maybeRemoveFakeBrowser(false);
|
||||||
|
});
|
||||||
|
|
||||||
if (browserContainer) {
|
if (browserContainer) {
|
||||||
gZenUIManager.motion
|
gZenUIManager.motion
|
||||||
@@ -1606,12 +1608,39 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
gBrowser.tabbox.removeAttribute('style');
|
this._maybeRemoveFakeBrowser(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleTabDrop(event, urls, replace, inBackground) {
|
||||||
|
if (!inBackground || replace || urls.length !== 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const url = urls[0];
|
||||||
|
if (!url.startsWith('panel-')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const browserContainer = document.getElementById(url);
|
||||||
|
const browser = browserContainer?.querySelector('browser');
|
||||||
|
if (!browser) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const tab = gBrowser.getTabForBrowser(browser);
|
||||||
|
if (!tab) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (tab.splitView) {
|
||||||
|
// Unsplit the tab and exit from the drag view
|
||||||
|
this.dropZone?.removeAttribute('enabled');
|
||||||
|
this.disableTabRearrangeView(event);
|
||||||
|
this.removeTabFromSplit(browserContainer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or creates a tab group for split view tabs
|
* Gets or creates a tab group for split view tabs
|
||||||
* @param {Array} tabs Initial tabs to add to the group if creating new
|
* @param {Array} tabs Initial tabs to add to the group if creating new
|
||||||
|
@@ -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..9151fa411faa9689c7b079fafe0fab1234177f40 100644
|
index fa96568d366fd3608f9bd583fa793150bd815c8b..a2a0ca3982634252abfdad20e768431a840ea19b 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 @@
|
||||||
@@ -97,6 +97,15 @@ index fa96568d366fd3608f9bd583fa793150bd815c8b..9151fa411faa9689c7b079fafe0fab12
|
|||||||
postTransitionCleanup();
|
postTransitionCleanup();
|
||||||
} else {
|
} else {
|
||||||
let onTransitionEnd = transitionendEvent => {
|
let onTransitionEnd = transitionendEvent => {
|
||||||
|
@@ -1249,7 +1263,7 @@
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+ if (gZenViewSplitter.handleTabDrop(event, urls, replace, inBackground)) return;
|
||||||
|
gBrowser.loadTabs(urls, {
|
||||||
|
inBackground,
|
||||||
|
replace,
|
||||||
@@ -1279,13 +1293,23 @@
|
@@ -1279,13 +1293,23 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user