mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-08 06:13:22 +00:00
chore: Refactor ZenViewSplitter to use async/await for openSplitViewPanel
This commit is contained in:
@@ -20,9 +20,6 @@ var gZenViewSplitter = {
|
||||
document.getElementById("tabContextMenu").appendChild(fragment);
|
||||
},
|
||||
|
||||
/**
|
||||
* context menu item display update
|
||||
*/
|
||||
initializeUpdateContextMenuItems() {
|
||||
const contentAreaContextMenu = document.getElementById("tabContextMenu");
|
||||
const tabCountInfo = JSON.stringify({
|
||||
@@ -45,7 +42,28 @@ var gZenViewSplitter = {
|
||||
gZenSplitViewsBase.onLocationChange(browser);
|
||||
},
|
||||
|
||||
openSplitViewPanel(event) {
|
||||
async openSplitViewPanel(event) {
|
||||
let panel = this._modifierElement;
|
||||
let target = event.target.parentNode;
|
||||
for (const gridType of ['horizontal', 'vertical', 'grid', 'unsplit']) {
|
||||
let selector = panel.querySelector(`.zen-split-view-modifier-preview.${gridType}`);
|
||||
selector.classList.remove("active");
|
||||
if (gZenSplitViewsBase.getActiveViewType() === gridType) {
|
||||
selector.classList.add("active");
|
||||
}
|
||||
if (this.__hasSetMenuListener) {
|
||||
continue;
|
||||
}
|
||||
selector.addEventListener("click", ((gridType) => {
|
||||
// TODO: Implement the split view
|
||||
panel.hidePopup();
|
||||
}).bind(this, gridType));
|
||||
}
|
||||
this.__hasSetMenuListener = true;
|
||||
PanelMultiView.openPopup(panel, target, {
|
||||
position: "bottomright topright",
|
||||
triggerEvent: event,
|
||||
}).catch(console.error);
|
||||
},
|
||||
|
||||
contextCanSplitTabs() {
|
||||
|
||||
@@ -209,17 +209,17 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#zenSplitViewModifierViewDefault .zen-split-view-modifier-preview.hsep {
|
||||
#zenSplitViewModifierViewDefault .zen-split-view-modifier-preview.horizontal {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#zenSplitViewModifierViewDefault .zen-split-view-modifier-preview.hsep box:last-child {
|
||||
#zenSplitViewModifierViewDefault .zen-split-view-modifier-preview.horizontal box:last-child {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#zenSplitViewModifierViewDefault .zen-split-view-modifier-preview.vsep box:last-child {
|
||||
#zenSplitViewModifierViewDefault .zen-split-view-modifier-preview.vertical box:last-child {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user