Skip to content
Merged
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 @@ -34,7 +34,7 @@ export abstract class UmbPropertyEditorUiRteElementBase extends UmbLitElement im
public set value(value: UmbPropertyEditorUiValueType | undefined) {
if (!value) {
this._value = undefined;
this._markup = this._latestMarkup = '';
this._markup = '';
this.#managerContext.setLayouts([]);
this.#managerContext.setContents([]);
this.#managerContext.setSettings([]);
Expand All @@ -52,7 +52,7 @@ export abstract class UmbPropertyEditorUiRteElementBase extends UmbLitElement im
this._value = buildUpValue as UmbPropertyEditorUiValueType;

// Only update the actual editor markup if it is not the same as the value.
if (this._latestMarkup !== this._value.markup) {
if (this._markup !== this._value.markup) {
this._markup = this._value.markup;
}

Expand Down Expand Up @@ -84,11 +84,6 @@ export abstract class UmbPropertyEditorUiRteElementBase extends UmbLitElement im
@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 @@ -141,7 +136,7 @@ export abstract class UmbPropertyEditorUiRteElementBase extends UmbLitElement im
this._value = undefined;
} else {
this._value = {
markup: this._latestMarkup,
markup: this._markup,
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,6 +61,7 @@ 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 @@ -43,16 +43,16 @@ export class UmbPropertyEditorUITinyMceElement extends UmbPropertyEditorUiRteEle
// Then get the content of the editor and update the value.
// maybe in this way doc.body.innerHTML;

this._latestMarkup = markup;
this._markup = markup;

if (this.value) {
this.value = {
...this.value,
markup: this._latestMarkup,
markup: this._markup,
};
} else {
this.value = {
markup: this._latestMarkup,
markup: this._markup,
blocks: {
layout: {},
contentData: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const TIPTAP_CORE_EXTENSION_ALIAS = 'Umb.Tiptap.RichTextEssentials';
export class UmbInputTiptapElement extends UmbFormControlMixin<string, typeof UmbLitElement, string>(UmbLitElement) {
@property({ type: String })
override set value(value: string) {
if (value === this.#value) return;
this.#value = value;

// Try to set the value to the editor if it is ready.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ export class UmbPropertyEditorUiTiptapElement extends UmbPropertyEditorUiRteElem

this._filterUnusedBlocks(usedContentKeys);

this._latestMarkup = value;
this._markup = value;

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