Skip to content

Commit

Permalink
fix setter for formatted field
Browse files Browse the repository at this point in the history
  • Loading branch information
hinanaya committed Jul 16, 2024
1 parent 0051a92 commit 9725d38
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ui/fields/formatted.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OBField } from "../base/field.js";

class OBFieldFormatted extends OBField {
#init;
#editorInstance;

async connectedCallback() {
if (this.#init) {
Expand All @@ -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,
Expand Down Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 9725d38

Please sign in to comment.