From e06359a24ab15d5c4227facc5d13bb01d150edfd Mon Sep 17 00:00:00 2001 From: KoloMl Date: Fri, 3 Jan 2025 03:43:02 +0400 Subject: [PATCH] Export the tag dropdown class, make tag name getter public --- src/lib/components/TagDropdownWrapper.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/components/TagDropdownWrapper.js b/src/lib/components/TagDropdownWrapper.js index 0eb5e3c..3be464f 100644 --- a/src/lib/components/TagDropdownWrapper.js +++ b/src/lib/components/TagDropdownWrapper.js @@ -5,7 +5,7 @@ import {getComponent} from "$lib/components/base/ComponentUtils.js"; const isTagEditorProcessedKey = Symbol(); -class TagDropdownWrapper extends BaseComponent { +export class TagDropdownWrapper extends BaseComponent { /** * Container with dropdown elements to insert options into. * @type {HTMLElement} @@ -53,7 +53,7 @@ class TagDropdownWrapper extends BaseComponent { }); } - get #tagName() { + get tagName() { return this.container.dataset.tagName; } @@ -89,7 +89,7 @@ class TagDropdownWrapper extends BaseComponent { const profileName = this.#activeProfile.settings.name; let profileSpecificButtonText = `Add to profile "${profileName}"`; - if (this.#activeProfile.settings.tags.includes(this.#tagName)) { + if (this.#activeProfile.settings.tags.includes(this.tagName)) { profileSpecificButtonText = `Remove from profile "${profileName}"`; } @@ -108,7 +108,7 @@ class TagDropdownWrapper extends BaseComponent { async #onAddToNewClicked() { const profile = new MaintenanceProfile(crypto.randomUUID(), { name: 'Temporary Profile (' + (new Date().toISOString()) + ')', - tags: [this.#tagName] + tags: [this.tagName] }); await profile.save(); @@ -121,7 +121,7 @@ class TagDropdownWrapper extends BaseComponent { } const tagsList = new Set(this.#activeProfile.settings.tags); - const targetTagName = this.#tagName; + const targetTagName = this.tagName; if (tagsList.has(targetTagName)) { tagsList.delete(targetTagName);