Tiptap RTE: Fixes undo when RTE is emptied (#20133)

* Tiptap RTE: prevent `undefined` value

If the `value` becomes `undefined`, then the block data can't be tracked (for undo/redo).
The scenario comes when a user "selects all" contents, cuts it, and pasted it back in.

Fixes #20076

* Tiptap RTE: fixes selection white text bug

* Tiptap RTE: amends heading styles (for first-child)
This commit is contained in:
Lee Kelleher
2025-09-16 09:14:20 +02:00
committed by GitHub
parent 4207e0360c
commit 343a07de71
3 changed files with 5 additions and 12 deletions

View File

@@ -84,10 +84,6 @@ export class UmbRefRteBlockElement extends UmbLitElement {
umb-icon,
umb-ufm-render {
z-index: 1;
&::selection {
color: var(--uui-color-default-contrast);
}
}
`,
];

View File

@@ -13,7 +13,11 @@ export default class UmbTiptapHeadingExtensionApi extends UmbTiptapExtensionApiB
h5,
h6 {
margin-top: 0;
margin-bottom: 0.5em;
margin-bottom: 1rem;
&:first-child {
margin-top: 0.25rem;
}
}
`;
}

View File

@@ -20,13 +20,6 @@ export class UmbPropertyEditorUiTiptapElement extends UmbPropertyEditorUiRteElem
const tipTapElement = event.target;
const markup = tipTapElement.value;
// If we don't get any markup clear the property editor value.
if (tipTapElement.isEmpty()) {
this.value = undefined;
this._fireChangeEvent();
return;
}
// Remove unused Blocks of Blocks Layout. Leaving only the Blocks that are present in Markup.
const usedContentKeys: string[] = [];