forked from ZenBrowserMirrors/zen-desktop
feat(workspaces): rename method to openCreateForm and update workspace creation logic
This commit is contained in:
parent
f89478bf67
commit
e4e92a463f
3 changed files with 50 additions and 3 deletions
|
@ -149,7 +149,7 @@
|
||||||
<toolbarbutton id="PanelUI-zen-workspaces-reorder-mode" oncommand="ZenWorkspaces.toggleReorderMode();" class="subviewbutton">
|
<toolbarbutton id="PanelUI-zen-workspaces-reorder-mode" oncommand="ZenWorkspaces.toggleReorderMode();" class="subviewbutton">
|
||||||
<image></image>
|
<image></image>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
<toolbarbutton id="PanelUI-zen-workspaces-new" oncommand="ZenWorkspaces.openSaveDialog();" class="subviewbutton">
|
<toolbarbutton id="PanelUI-zen-workspaces-new" oncommand="ZenWorkspaces.openCreateForm();" class="subviewbutton">
|
||||||
<image></image>
|
<image></image>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
|
@ -365,7 +365,7 @@ menuitem {
|
||||||
}
|
}
|
||||||
|
|
||||||
& .zen-toast {
|
& .zen-toast {
|
||||||
padding: 0.9rem 0.8rem;
|
padding: 0.5rem 0.6rem;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
170deg,
|
170deg,
|
||||||
|
|
|
@ -1913,7 +1913,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
async createAndSaveWorkspace(name = 'New Workspace', isDefault = false, icon = undefined, dontChange = false) {
|
async createAndSaveWorkspace(name = 'Space', isDefault = false, icon = undefined, dontChange = false) {
|
||||||
if (!this.workspaceEnabled) {
|
if (!this.workspaceEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2395,4 +2395,51 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
this._processingResize = false;
|
this._processingResize = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openCreateForm() {
|
||||||
|
window.docShell.treeOwner
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIAppWindow)
|
||||||
|
.rollupAllPopups();
|
||||||
|
this.selectEmptyTab();
|
||||||
|
const sidebarWidth = gNavToolbox.style.getPropertyValue('--actual-zen-sidebar-width');
|
||||||
|
let elementsToAnimate = [gNavToolbox];
|
||||||
|
if (gZenVerticalTabsManager._hasSetSingleToolbar) {
|
||||||
|
elementsToAnimate.push(gURLBar.textbox);
|
||||||
|
}
|
||||||
|
this._creatingNewWorkspace = true;
|
||||||
|
gNavToolbox.style.zIndex = -1;
|
||||||
|
await Promise.all([
|
||||||
|
gZenUIManager.motion.animate(elementsToAnimate, {
|
||||||
|
transform: ['scale(1)', 'scale(0.8)'],
|
||||||
|
opacity: [1, 0],
|
||||||
|
}),
|
||||||
|
gZenUIManager.motion.animate(
|
||||||
|
gBrowser.tabpanels,
|
||||||
|
{
|
||||||
|
marginLeft: ['0px', '-' + sidebarWidth],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
delay: 0.2,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.createAndSaveWorkspace()
|
||||||
|
]);
|
||||||
|
const form = window.MozXULElement.parseXULToFragment(`
|
||||||
|
<hbox id="zen-workspace-create-form-wrapper">
|
||||||
|
<vbox id="zen-workspace-create-form">
|
||||||
|
<vbox>
|
||||||
|
<label id="zen-workspace-create-form-title" data-l10n-id="zen-workspace-create-form-title" />
|
||||||
|
<description data-l10n-id="zen-workspace-create-form-description" />
|
||||||
|
</vbox>
|
||||||
|
<vbox>
|
||||||
|
<hbox class="PanelUI-zen-workspaces-creation-wraper">
|
||||||
|
<hbox class="PanelUI-zen-workspaces-icons-container create" onclick="ZenWorkspaces.onWorkspaceIconContainerClick(event);"></hbox>
|
||||||
|
<html:input autofocus="true" id="PanelUI-zen-workspaces-create-input" type="text" placeholder="Enter workspace name" oninput="ZenWorkspaces.onWorkspaceCreationNameChange(this);" />
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
</vbox>
|
||||||
|
</hbox>
|
||||||
|
`);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue