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 @@ -54,6 +54,12 @@ export class RichTextPreviewCustomView extends BlockPreviewBaseElement<BlockCont

protected setupContextObservers() {
this.observePropertyDataset();
// Observe the block entry/manager contexts independently of the workspace.
// These RTE-specific contexts are always available to the block view, whereas
// UMB_DOCUMENT_WORKSPACE_CONTEXT is absent when the host block is edited inside a
// side-panel modal (e.g. an RTE field on a block nested in a Block Grid/List).
// Gating this behind the document workspace meant the preview never rendered there.
this.observeBlockValue();
this.#observeDocumentWorkspace();
}

Expand All @@ -78,7 +84,13 @@ export class RichTextPreviewCustomView extends BlockPreviewBaseElement<BlockCont
}
}

#entryObserved = false;

protected observeBlockValue(): void {
// Set up the entry-context subscription only once; it is now invoked both from
// setupContextObservers and (for the document-level case) from handleWorkspaceData.
if (this.#entryObserved) return;
this.#entryObserved = true;
this.consumeContext(UMB_BLOCK_RTE_ENTRY_CONTEXT, (context) => {
if (context != null) {
this.observe(
Expand All @@ -102,7 +114,10 @@ export class RichTextPreviewCustomView extends BlockPreviewBaseElement<BlockCont
this._blockContext.contentElementTypeAlias = contentElementTypeAlias ?? '';
this._blockContext.contentElementTypeKey = contentElementTypeKey ?? '';

if (!this.#managerObserved) {
// Only subscribe to manager context once contentUdi is known; subscribing with
// an empty key causes the manager to filter contentData to [] on its first emit,
// and the #managerObserved guard then blocks a corrective re-subscription.
if (!this.#managerObserved && this._blockContext.contentUdi) {
this.#managerObserved = true;
await this.#observeBlockPropertyValue();
}
Expand Down
Loading
Loading