mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 14:49:57 +02:00
Refactor workspace icon picker element IDs
This commit is contained in:
parent
cb51987dc2
commit
e13fa2315e
1 changed files with 8 additions and 7 deletions
|
@ -188,7 +188,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
);
|
);
|
||||||
|
|
||||||
_initializeWorkspaceCreationIcons() {
|
_initializeWorkspaceCreationIcons() {
|
||||||
let container = document.getElementById('PanelUI-zen-workspaces-icon-picker');
|
let container = document.getElementById('PanelUI-zen-workspaces-icon-picker-wrapper');
|
||||||
for (let icon of this._kIcons) {
|
for (let icon of this._kIcons) {
|
||||||
let button = document.createXULElement('toolbarbutton');
|
let button = document.createXULElement('toolbarbutton');
|
||||||
button.className = 'toolbarbutton-1';
|
button.className = 'toolbarbutton-1';
|
||||||
|
@ -259,7 +259,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
this.onWorkspaceIconChangeInner('edit', ...args);
|
this.onWorkspaceIconChangeInner('edit', ...args);
|
||||||
this.onWorkspaceEditChange();
|
this.onWorkspaceEditChange();
|
||||||
};
|
};
|
||||||
document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker toolbarbutton').forEach((button) => {
|
document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => {
|
||||||
if (button.label === workspaceData.icon) {
|
if (button.label === workspaceData.icon) {
|
||||||
button.setAttribute('selected', 'true');
|
button.setAttribute('selected', 'true');
|
||||||
} else {
|
} else {
|
||||||
|
@ -616,9 +616,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
|
|
||||||
this._workspaceButtonContextMenuListener = (event) => {
|
this._workspaceButtonContextMenuListener = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
browser.ZenWorkspaces.openWorkspacesDialog(event);
|
event.stopPropagation();
|
||||||
|
this.openWorkspacesDialog(event);
|
||||||
};
|
};
|
||||||
button.addEventListener('contextmenu', this._workspaceButtonContextMenuListener);
|
button.addEventListener('contextmenu', this._workspaceButtonContextMenuListener.bind(browser.ZenWorkspaces));
|
||||||
} else {
|
} else {
|
||||||
let activeWorkspace = await this.getActiveWorkspace();
|
let activeWorkspace = await this.getActiveWorkspace();
|
||||||
if (activeWorkspace) {
|
if (activeWorkspace) {
|
||||||
|
@ -706,7 +707,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._workspaceCreateInput.value = '';
|
this._workspaceCreateInput.value = '';
|
||||||
let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker [selected]');
|
let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker-wrapper [selected]');
|
||||||
icon?.removeAttribute('selected');
|
icon?.removeAttribute('selected');
|
||||||
await this.createAndSaveWorkspace(workspaceName, false, icon?.label);
|
await this.createAndSaveWorkspace(workspaceName, false, icon?.label);
|
||||||
await this._propagateWorkspaceData();
|
await this._propagateWorkspaceData();
|
||||||
|
@ -720,7 +721,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._workspaceEditInput.value = '';
|
this._workspaceEditInput.value = '';
|
||||||
let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker [selected]');
|
let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker-wrapper [selected]');
|
||||||
icon?.removeAttribute('selected');
|
icon?.removeAttribute('selected');
|
||||||
let workspaces = (await this._workspaces()).workspaces;
|
let workspaces = (await this._workspaces()).workspaces;
|
||||||
let workspaceData = workspaces.find((workspace) => workspace.uuid === workspaceUuid);
|
let workspaceData = workspaces.find((workspace) => workspace.uuid === workspaceUuid);
|
||||||
|
@ -743,7 +744,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
onWorkspaceEditChange() {
|
onWorkspaceEditChange() {
|
||||||
let button = document.getElementById('PanelUI-zen-workspaces-edit-save');
|
let button = document.getElementById('PanelUI-zen-workspaces-edit-save');
|
||||||
let name = this._workspaceEditInput.value;
|
let name = this._workspaceEditInput.value;
|
||||||
let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker [selected]')?.label;
|
let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker-wrapper [selected]')?.label;
|
||||||
if (
|
if (
|
||||||
name === this._workspaceEditInput.getAttribute('data-initial-value') &&
|
name === this._workspaceEditInput.getAttribute('data-initial-value') &&
|
||||||
icon === this._workspaceEditIconsContainer.getAttribute('data-initial-value')
|
icon === this._workspaceEditIconsContainer.getAttribute('data-initial-value')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue