From ef022f1eb1037b1032a3afb60263e256459a99b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 27 Aug 2024 15:54:24 +0200 Subject: [PATCH] refactor --- .../property-editor-ui-block-grid.element.ts | 11 ++--------- .../property-editor-ui-block-list.element.ts | 11 ++--------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts index 15427f71f9..5c5ac3fe77 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts @@ -81,21 +81,14 @@ export class UmbPropertyEditorUIBlockGridElement this.observe( context.dataPath, (dataPath) => { - // Translate paths for content elements: + // Translate paths for content/settings: this.#contentDataPathTranslator?.destroy(); - if (dataPath) { - // Set the data path for the local validation context: - this.#validationContext.setDataPath(dataPath); - - this.#contentDataPathTranslator = new UmbBlockElementDataValidationPathTranslator(this, 'contentData'); - } - - // Translate paths for settings elements: this.#settingsDataPathTranslator?.destroy(); if (dataPath) { // Set the data path for the local validation context: this.#validationContext.setDataPath(dataPath); + this.#contentDataPathTranslator = new UmbBlockElementDataValidationPathTranslator(this, 'contentData'); this.#settingsDataPathTranslator = new UmbBlockElementDataValidationPathTranslator(this, 'settingsData'); } }, diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts index 9e263cf849..46efbf4fe4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts @@ -139,21 +139,14 @@ export class UmbPropertyEditorUIBlockListElement this.observe( context.dataPath, (dataPath) => { - // Translate paths for content elements: + // Translate paths for content/settings: this.#contentDataPathTranslator?.destroy(); - if (dataPath) { - // Set the data path for the local validation context: - this.#validationContext.setDataPath(dataPath); - - this.#contentDataPathTranslator = new UmbBlockElementDataValidationPathTranslator(this, 'contentData'); - } - - // Translate paths for settings elements: this.#settingsDataPathTranslator?.destroy(); if (dataPath) { // Set the data path for the local validation context: this.#validationContext.setDataPath(dataPath); + this.#contentDataPathTranslator = new UmbBlockElementDataValidationPathTranslator(this, 'contentData'); this.#settingsDataPathTranslator = new UmbBlockElementDataValidationPathTranslator(this, 'settingsData'); } },