From 4903446013c0ec6bef157840f418fd4bfcd2d34f Mon Sep 17 00:00:00 2001 From: HeikoMueller Date: Thu, 29 Aug 2024 09:47:01 +0200 Subject: [PATCH] Fix the image tune menu toggle state in the block editor interface (#23510) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rijk van Zanten Co-authored-by: Hannes Küttner --- .changeset/rare-pumpkins-decide.md | 5 +++++ app/src/interfaces/input-block-editor/plugins.ts | 6 +++++- contributors.yml | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/rare-pumpkins-decide.md diff --git a/.changeset/rare-pumpkins-decide.md b/.changeset/rare-pumpkins-decide.md new file mode 100644 index 0000000000..a120af598b --- /dev/null +++ b/.changeset/rare-pumpkins-decide.md @@ -0,0 +1,5 @@ +--- +'@directus/app': patch +--- + +Fixed the image tune menu toggle state indication in the block editor interface diff --git a/app/src/interfaces/input-block-editor/plugins.ts b/app/src/interfaces/input-block-editor/plugins.ts index c1d5a2111a..e45faa5bea 100644 --- a/app/src/interfaces/input-block-editor/plugins.ts +++ b/app/src/interfaces/input-block-editor/plugins.ts @@ -179,7 +179,7 @@ export class ImageTool extends BaseImageTool { bus.emit({ type: 'open-url', payload: this.data.file.fileURL }); }, }, - ...ImageTool.tunes, + ...BaseImageTool.tunes, ]; const wrapperElement = document.createElement('div'); @@ -201,6 +201,10 @@ export class ImageTool extends BaseImageTool { titleElement.innerHTML = tune.title; tuneElement.appendChild(titleElement); + if (tune.toggle && tune.name && this._data[tune.name]) { + tuneElement.classList.add('ce-popover-item--active'); + } + if (tune.onActivate) tuneElement.addEventListener('click', tune.onActivate); else if (tune.toggle) tuneElement.addEventListener('click', () => { diff --git a/contributors.yml b/contributors.yml index ed204df649..608b9c30d9 100644 --- a/contributors.yml +++ b/contributors.yml @@ -159,4 +159,5 @@ - FatumaA - HZooly - simboonlong +- HeikoMueller - janpio