diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index 23452ce7f6..5e8e02b180 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -36,7 +36,7 @@ "diff": "^5.2.0", "dompurify": "^3.1.6", "element-internals-polyfill": "^1.3.11", - "lit": "^3.1.4", + "lit": "^3.2.0", "marked": "^14.1.0", "monaco-editor": "^0.50.0", "rxjs": "^7.8.1", @@ -70,7 +70,7 @@ "@web/dev-server-rollup": "^0.6.4", "@web/test-runner": "^0.18.3", "@web/test-runner-playwright": "^0.11.0", - "babel-loader": "^9.1.3", + "babel-loader": "^9.2.1", "eslint": "^9.7.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", @@ -10588,9 +10588,9 @@ } }, "node_modules/babel-loader": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.2.1.tgz", + "integrity": "sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA==", "dev": true, "dependencies": { "find-cache-dir": "^4.0.0", diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index 1a51def72e..be58ac386c 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -220,7 +220,7 @@ "diff": "^5.2.0", "dompurify": "^3.1.6", "element-internals-polyfill": "^1.3.11", - "lit": "^3.1.4", + "lit": "^3.2.0", "marked": "^14.1.0", "monaco-editor": "^0.50.0", "rxjs": "^7.8.1", @@ -254,7 +254,7 @@ "@web/dev-server-rollup": "^0.6.4", "@web/test-runner": "^0.18.3", "@web/test-runner-playwright": "^0.11.0", - "babel-loader": "^9.1.3", + "babel-loader": "^9.2.1", "eslint": "^9.7.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", diff --git a/src/Umbraco.Web.UI.Client/src/packages/tiptap/property-editors/tiptap/components/property-editor-ui-tiptap-toolbar-configuration.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tiptap/property-editors/tiptap/components/property-editor-ui-tiptap-toolbar-configuration.element.ts index 74d387c06a..7078d2318a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tiptap/property-editors/tiptap/components/property-editor-ui-tiptap-toolbar-configuration.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tiptap/property-editors/tiptap/components/property-editor-ui-tiptap-toolbar-configuration.element.ts @@ -32,17 +32,18 @@ export class UmbPropertyEditorUiTiptapToolbarConfigurationElement @property({ attribute: false }) set value(value: UmbTiptapToolbarValue | undefined) { - if (!value) { + if (!this.#isValidTiptapToolbarValue(value)) { this.#value = [[[]]]; - } else { - // TODO: This can be optimized with cashing; - this.#value = value ? value.map((rows) => rows.map((groups) => [...groups])) : [[[]]]; + return; + } + + if (value.length > 0) { + this.#value = value.map((rows) => rows.map((groups) => [...groups])); value.forEach((row) => row.forEach((group) => group.forEach((alias) => this.#inUse.add(alias)))); } } get value(): UmbTiptapToolbarValue { - // TODO: This can be optimized with cashing; - return this.#value.map((rows) => rows.map((groups) => [...groups])); + return this.#value; } #value: UmbTiptapToolbarValue = [[[]]]; @@ -55,6 +56,20 @@ export class UmbPropertyEditorUiTiptapToolbarConfigurationElement }); } + #isValidTiptapToolbarValue(value: unknown): value is UmbTiptapToolbarValue { + if (!Array.isArray(value)) return false; + for (const row of value) { + if (!Array.isArray(row)) return false; + for (const group of row) { + if (!Array.isArray(group)) return false; + for (const alias of group) { + if (typeof alias !== 'string') return false; + } + } + } + return true; + } + #onDragStart(event: DragEvent, alias: string, fromPos?: [number, number, number]) { event.dataTransfer!.effectAllowed = 'move'; this.#currentDragItem = { alias, fromPos };