mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:29:59 +02:00
Refactor ZenGlanceManager.mjs to prevent opening multiple glances when animation is in progress or there is no current browser
Refactor ZenWorkspaces.mjs to update the save dialog with a randomly selected icon
This commit is contained in:
parent
5eb4fb0d0d
commit
5daa3ffa53
2 changed files with 17 additions and 1 deletions
|
@ -136,7 +136,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
closeGlance({ noAnimation = false } = {}) {
|
closeGlance({ noAnimation = false } = {}) {
|
||||||
if (this.#animating) {
|
if (this.#animating || !this.#currentBrowser) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,22 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
|
|
||||||
openSaveDialog() {
|
openSaveDialog() {
|
||||||
let parentPanel = document.getElementById('PanelUI-zen-workspaces-multiview');
|
let parentPanel = document.getElementById('PanelUI-zen-workspaces-multiview');
|
||||||
|
|
||||||
|
// randomly select an icon
|
||||||
|
let icon = this._kIcons[Math.floor(Math.random() * this._kIcons.length)];
|
||||||
|
this._workspaceCreateInput.textContent = '';
|
||||||
|
this._workspaceCreateInput.value = '';
|
||||||
|
this._workspaceCreateInput.setAttribute('data-initial-value', '');
|
||||||
|
this._workspaceCreateIconsContainer.setAttribute('data-initial-value', icon);
|
||||||
|
document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => {
|
||||||
|
if (button.label === icon) {
|
||||||
|
button.setAttribute('selected', 'true');
|
||||||
|
} else {
|
||||||
|
button.removeAttribute('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.querySelector('.PanelUI-zen-workspaces-icons-container.create').textContent = icon;
|
||||||
|
|
||||||
PanelUI.showSubView('PanelUI-zen-workspaces-create', parentPanel);
|
PanelUI.showSubView('PanelUI-zen-workspaces-create', parentPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue