mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-26 16:31:30 +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._maybeRemoveFakeBrowser(false);
|
||||
window.requestAnimationFrame(() => {
|
||||
this._maybeRemoveFakeBrowser(false);
|
||||
});
|
||||
|
||||
if (browserContainer) {
|
||||
gZenUIManager.motion
|
||||
@@ -1606,12 +1608,39 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
gBrowser.tabbox.removeAttribute('style');
|
||||
this._maybeRemoveFakeBrowser(false);
|
||||
});
|
||||
}
|
||||
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
|
||||
* @param {Array} tabs Initial tabs to add to the group if creating new
|
||||
|
||||
Reference in New Issue
Block a user