feat: only calculate html on updates

This commit is contained in:
Jacob Overgaard
2024-09-19 16:35:03 +02:00
parent 4a190da8f0
commit 4f06d69296

View File

@@ -43,6 +43,7 @@ export class UmbInputTiptapElement extends UmbFormControlMixin<string, typeof Um
@property({ type: String })
override set value(value: string) {
console.log('update scheduled', value);
this.#markup = value;
// Try to set the value to the editor if it is ready.
@@ -51,7 +52,7 @@ export class UmbInputTiptapElement extends UmbFormControlMixin<string, typeof Um
}
}
override get value() {
return this._editor?.getHTML() ?? this.#markup;
return this.#markup;
}
#markup = '';
@@ -122,6 +123,7 @@ export class UmbInputTiptapElement extends UmbFormControlMixin<string, typeof Um
],
content: this.#markup,
onUpdate: () => {
this.#markup = this._editor.getHTML();
this.dispatchEvent(new UmbChangeEvent());
},
});