Merge pull request #64 from Richard-Woessner/dev

Fix issue with workspace icon not updating on edit
This commit is contained in:
mr. m 🤙 2024-10-24 22:38:41 +03:00 committed by GitHub
commit c7e1f293a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -279,7 +279,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._workspaceEditIconsContainer.setAttribute('data-initial-value', workspaceData.icon); this._workspaceEditIconsContainer.setAttribute('data-initial-value', workspaceData.icon);
this.onIconChangeConnectedCallback = (...args) => { this.onIconChangeConnectedCallback = (...args) => {
this.onWorkspaceIconChangeInner('edit', ...args); this.onWorkspaceIconChangeInner('edit', ...args);
this.onWorkspaceEditChange(); this.onWorkspaceEditChange(...args);
}; };
document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => { document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => {
if (button.label === workspaceData.icon) { if (button.label === workspaceData.icon) {
@ -295,7 +295,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
onWorkspaceIconChangeInner(type = 'create', icon) { onWorkspaceIconChangeInner(type = 'create', icon) {
const container = document.querySelector(`.PanelUI-zen-workspaces-icons-container.${type}`); const container = document.querySelector(`.PanelUI-zen-workspaces-icons-container.${type}`);
container.textContent = icon; if (container.textContent !== icon) {
container.textContent = icon;
}
this.goToPreviousSubView(); this.goToPreviousSubView();
} }
@ -843,10 +845,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
button.removeAttribute('disabled'); button.removeAttribute('disabled');
} }
onWorkspaceEditChange() { onWorkspaceEditChange(icon) {
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-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')