diff --git a/src/Umbraco.Web.UI.Client/src/packages/rte/components/rte-base.element.ts b/src/Umbraco.Web.UI.Client/src/packages/rte/components/rte-base.element.ts index 0749d8fbd21b..2fec0e785941 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/rte/components/rte-base.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/rte/components/rte-base.element.ts @@ -42,7 +42,7 @@ export abstract class UmbPropertyEditorUiRteElementBase public override set value(value: UmbPropertyEditorRteValueType | undefined) { if (!value) { super.value = undefined; - this._markup = ''; + this._markup = this._latestMarkup = ''; this.#managerContext.setLayouts([]); this.#managerContext.setContents([]); this.#managerContext.setSettings([]); @@ -60,7 +60,7 @@ export abstract class UmbPropertyEditorUiRteElementBase super.value = buildUpValue as UmbPropertyEditorRteValueType; // Only update the actual editor markup if it is not the same as the value. - if (this._markup !== super.value.markup) { + if (this._latestMarkup !== super.value.markup) { this._markup = super.value.markup; } @@ -106,6 +106,11 @@ export abstract class UmbPropertyEditorUiRteElementBase @state() protected _markup = ''; + /** + * The latest value gotten from the RTE editor. + */ + protected _latestMarkup = ''; + readonly #managerContext = new UmbBlockRteManagerContext(this); readonly #entriesContext = new UmbBlockRteEntriesContext(this); @@ -183,7 +188,7 @@ export abstract class UmbPropertyEditorUiRteElementBase } } else { super.value = { - markup: this._markup, + markup: this._latestMarkup, blocks: { layout: { [UMB_BLOCK_RTE_PROPERTY_EDITOR_SCHEMA_ALIAS]: layouts }, contentData: contents, diff --git a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.element.ts index bcd7a805bc11..c61116da940f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/components/input-tiny-mce/input-tiny-mce.element.ts @@ -61,7 +61,6 @@ export class UmbInputTinyMceElement extends UUIFormControlMixin(UmbLitElement, ' } override set value(newValue: FormDataEntryValue | FormData) { - if (newValue === this.value) return; super.value = newValue; const newContent = typeof newValue === 'string' ? newValue : ''; diff --git a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.ts index 5e796a3d854c..a07b3b1d4fe2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/tiny-mce/property-editor-ui-tiny-mce.element.ts @@ -38,14 +38,19 @@ export class UmbPropertyEditorUITinyMceElement extends UmbPropertyEditorUiRteEle blockElement.getAttribute(UMB_BLOCK_RTE_DATA_CONTENT_KEY), ); - if (super.value) { - super.value = { - ...super.value, - markup: markup, + // Then get the content of the editor and update the value. + // maybe in this way doc.body.innerHTML; + + this._latestMarkup = markup; + + if (this.value) { + this.value = { + ...this.value, + markup: this._latestMarkup, }; } else { this.value = { - markup: markup, + markup: this._latestMarkup, blocks: { layout: {}, contentData: [],