Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Comment on lines +42 to +43
Copy link

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment is ambiguous and may cause confusion; consider clarifying its intent or removing it if no longer needed.

Suggested change
// maybe in this way doc.body.innerHTML;
// TODO: Consider using doc.body.innerHTML to get the content of the editor.

Copilot uses AI. Check for mistakes.
this._latestMarkup = markup;

if (this.value) {
this.value = {
...this.value,
markup: this._latestMarkup,
};
} else {
this.value = {
markup: markup,
markup: this._latestMarkup,
blocks: {
layout: {},
contentData: [],
Expand Down
Loading