Skip to content

Commit 8182b60

Browse files
committed
Merge branch 'main' into release/15.0
2 parents 9455934 + c2482c3 commit 8182b60

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
"diff": "^5.2.0",
221221
"dompurify": "^3.1.6",
222222
"element-internals-polyfill": "^1.3.11",
223-
"lit": "^3.1.4",
223+
"lit": "^3.2.0",
224224
"marked": "^14.1.0",
225225
"monaco-editor": "^0.50.0",
226226
"rxjs": "^7.8.1",
@@ -254,7 +254,7 @@
254254
"@web/dev-server-rollup": "^0.6.4",
255255
"@web/test-runner": "^0.18.3",
256256
"@web/test-runner-playwright": "^0.11.0",
257-
"babel-loader": "^9.1.3",
257+
"babel-loader": "^9.2.1",
258258
"eslint": "^9.7.0",
259259
"eslint-config-prettier": "^9.1.0",
260260
"eslint-plugin-import": "^2.29.1",

src/packages/tiptap/property-editors/tiptap/components/property-editor-ui-tiptap-toolbar-configuration.element.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,18 @@ export class UmbPropertyEditorUiTiptapToolbarConfigurationElement
3232

3333
@property({ attribute: false })
3434
set value(value: UmbTiptapToolbarValue | undefined) {
35-
if (!value) {
35+
if (!this.#isValidTiptapToolbarValue(value)) {
3636
this.#value = [[[]]];
37-
} else {
38-
// TODO: This can be optimized with cashing;
39-
this.#value = value ? value.map((rows) => rows.map((groups) => [...groups])) : [[[]]];
37+
return;
38+
}
39+
40+
if (value.length > 0) {
41+
this.#value = value.map((rows) => rows.map((groups) => [...groups]));
4042
value.forEach((row) => row.forEach((group) => group.forEach((alias) => this.#inUse.add(alias))));
4143
}
4244
}
4345
get value(): UmbTiptapToolbarValue {
44-
// TODO: This can be optimized with cashing;
45-
return this.#value.map((rows) => rows.map((groups) => [...groups]));
46+
return this.#value;
4647
}
4748
#value: UmbTiptapToolbarValue = [[[]]];
4849

@@ -55,6 +56,20 @@ export class UmbPropertyEditorUiTiptapToolbarConfigurationElement
5556
});
5657
}
5758

59+
#isValidTiptapToolbarValue(value: unknown): value is UmbTiptapToolbarValue {
60+
if (!Array.isArray(value)) return false;
61+
for (const row of value) {
62+
if (!Array.isArray(row)) return false;
63+
for (const group of row) {
64+
if (!Array.isArray(group)) return false;
65+
for (const alias of group) {
66+
if (typeof alias !== 'string') return false;
67+
}
68+
}
69+
}
70+
return true;
71+
}
72+
5873
#onDragStart(event: DragEvent, alias: string, fromPos?: [number, number, number]) {
5974
event.dataTransfer!.effectAllowed = 'move';
6075
this.#currentDragItem = { alias, fromPos };

0 commit comments

Comments
 (0)