feat: introduce a backing field for markup to be able to add markup from the beginning

This commit is contained in:
Jacob Overgaard
2024-09-19 16:31:05 +02:00
parent c8bdfd2ac3
commit 4587ff63b9

View File

@@ -43,12 +43,19 @@ export class UmbInputTiptapElement extends UmbFormControlMixin<string, typeof Um
@property({ type: String })
override set value(value: string) {
this._editor?.commands.setContent(value);
this.#markup = value;
// Try to set the value to the editor if it is ready.
if (this._editor) {
this._editor.commands.setContent(value);
}
}
override get value() {
return this._editor?.getHTML() ?? '';
return this._editor?.getHTML() ?? this.#markup;
}
#markup = '';
@property({ attribute: false })
configuration!: UmbPropertyEditorConfigCollection;