From 9725d38db4281c347c0a3e795f27878df725d7a5 Mon Sep 17 00:00:00 2001 From: Sanae Date: Tue, 16 Jul 2024 20:16:53 +0000 Subject: [PATCH] fix setter for formatted field --- ui/fields/formatted.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/fields/formatted.js b/ui/fields/formatted.js index 0065c0f5..45b7e440 100644 --- a/ui/fields/formatted.js +++ b/ui/fields/formatted.js @@ -3,6 +3,7 @@ import { OBField } from "../base/field.js"; class OBFieldFormatted extends OBField { #init; + #editorInstance; async connectedCallback() { if (this.#init) { @@ -11,7 +12,7 @@ class OBFieldFormatted extends OBField { this.#init = true; this.renderComponent().then(() => { - var easyMDE = new EasyMDE({ + this.#editorInstance = new EasyMDE({ element: this.root.querySelector("#edit"), minHeight: "200px", autoDownloadFontAwesome: false, @@ -72,7 +73,12 @@ class OBFieldFormatted extends OBField { } set value(value) { - this.root.querySelector("#edit").value = value; + if (this.#editorInstance) { + this.#editorInstance.value(value); + } else { + this.root.querySelector("#edit").value = value; + } + this.renderComponent(); } }