From 5e6a7d04aa988f84ca682eed99a33aaa51897761 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Tue, 19 Mar 2024 10:15:58 +0000 Subject: [PATCH] Bugfix: Tags amends The config was replacing the `value` with the non-existent `items`, meaning that the editor would always appear empty. Added the `storageType` field, unsure if this will be used on the client yet. --- .../tags/property-editor-ui-tags.element.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts index 4a484b3920..40b49ce6d6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts @@ -5,6 +5,8 @@ import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/ import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import '../../components/tags-input/tags-input.element.js'; + /** * @element umb-property-editor-ui-tags */ @@ -23,17 +25,21 @@ export class UmbPropertyEditorUITagsElement extends UmbLitElement implements Umb @state() private _group?: string; + @state() + private _storageType?: string; + @state() private _culture?: string | null; //TODO: Use type from VariantID public set config(config: UmbPropertyEditorConfigCollection | undefined) { this._group = config?.getValueByAlias('group'); - this.value = config?.getValueByAlias('items') ?? []; + this._storageType = config?.getValueByAlias('storageType'); } constructor() { super(); + this.consumeContext(UMB_PROPERTY_CONTEXT, (context) => { this.observe(context.variantId, (id) => { if (id && id.culture !== undefined) { @@ -43,7 +49,7 @@ export class UmbPropertyEditorUITagsElement extends UmbLitElement implements Umb }); } - private _onChange(event: CustomEvent) { + #onChange(event: CustomEvent) { this.value = ((event.target as UmbTagsInputElement).value as string).split(','); this.dispatchEvent(new CustomEvent('property-value-change')); } @@ -53,7 +59,7 @@ export class UmbPropertyEditorUITagsElement extends UmbLitElement implements Umb group="${ifDefined(this._group)}" .culture=${this._culture} .items=${this.value} - @change=${this._onChange}>`; + @change=${this.#onChange}>`; } }