From 100ac1284024c6ff45d6251dfe23fdc1ba3122a2 Mon Sep 17 00:00:00 2001 From: Markus Johansson Date: Mon, 22 Jan 2024 00:01:55 +0100 Subject: [PATCH] #1136 update rte when value changes --- .../input-tiny-mce/input-tiny-mce.element.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-tiny-mce/input-tiny-mce.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/components/input-tiny-mce/input-tiny-mce.element.ts index 7ef6f439f7..656bbd7b52 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-tiny-mce/input-tiny-mce.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/components/input-tiny-mce/input-tiny-mce.element.ts @@ -42,6 +42,19 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) { return this._editorElement?.querySelector('iframe') ?? undefined; } + set value(newValue: FormDataEntryValue | FormData) { + this._value = newValue; + const newContent = newValue?.toString() ?? ''; + + if(this.#editorRef && this.#editorRef.getContent() != newContent) { + this.#editorRef.setContent(newContent); + } + } + + get value(): FormDataEntryValue | FormData { + return this._value; + } + @query('#editor', true) private _editorElement?: HTMLElement;