Skip to content

fix: Render RTE block previews nested in a side-panel modal (#300)#302

Merged
rickbutterfield merged 1 commit into
v5/devfrom
v5/bugfix/300-rte-nested-preview
Jun 30, 2026
Merged

fix: Render RTE block previews nested in a side-panel modal (#300)#302
rickbutterfield merged 1 commit into
v5/devfrom
v5/bugfix/300-rte-nested-preview

Conversation

@rickbutterfield

Copy link
Copy Markdown
Owner

Fixes #300 (and the Rich Text / nested half of #294).

Problem

RTE block previews stayed blank (raw <umb-rte-block>, no error) when the rich text field belonged to a block edited in a side-panel modal — e.g. a Rich Text property on a block nested in a Block Grid/List.

Root cause

The RTE custom view set up its block entry/manager-context observation from handleWorkspaceData(), which only runs once UMB_DOCUMENT_WORKSPACE_CONTEXT resolves. Inside a block-edit modal there is no document workspace context, so handleWorkspaceData() — and therefore observeBlockValue() — never ran. contentUdi/blockEditorAlias stayed empty and the preview rendered nothing (with no error). The try/catch fallback in #observeDocumentWorkspace never fired because consumeContext does not throw.

Fix

Observe the RTE entry/manager contexts independently of the workspace (they are always available to the block view) by calling observeBlockValue() from setupContextObservers(), guarded so it subscribes only once. unique/documentTypeUnique still resolve via the shared BlockPreview context. Also only subscribe to the manager once contentUdi is known, matching the Block List/Grid views.

Verification

Verified live against the test site (Umbraco 17.5): the embedded card preview now renders inside the tiptap editor in the modal; Block Grid (30/30) and Block List previews are unaffected, zero preview errors.

Note on the bundle

The compiled wwwroot bundle had not been rebuilt since 5.4.0, so this also re-bundles the previously-merged 5.4.x source fixes. The companion PR adds a frontend build to the release workflow so this can't recur.

🤖 Generated with Claude Code

RTE block previews stayed blank (raw <umb-rte-block>) when the rich text
field belonged to a block edited in a side-panel modal — e.g. a Rich Text
property on a block nested in a Block Grid/List.

Root cause: the RTE custom view set up its block entry/manager-context
observation from handleWorkspaceData(), which only runs once
UMB_DOCUMENT_WORKSPACE_CONTEXT resolves. Inside a block-edit modal there is
no document workspace context, so handleWorkspaceData() — and therefore
observeBlockValue() — never ran, leaving contentUdi/blockEditorAlias empty
and producing an empty (but error-free) preview. The try/catch fallback in

Fix: observe the RTE entry/manager contexts independently of the workspace
(they are always available to the block view) by calling observeBlockValue()
from setupContextObservers(), guarded so it subscribes only once. unique /
documentTypeUnique still resolve via the shared BlockPreview context. Also
only subscribe to the manager once contentUdi is known, matching the
Block List/Grid views.

Verified live (Umbraco 17.5): the embedded card preview now renders inside
the tiptap editor, with Block Grid (30/30) and Block List previews
unaffected. Adds a Playwright regression test plus a renderedCount assertion
so the empty-but-error-free failure mode is actually caught.

Note: the compiled wwwroot bundle had not been rebuilt since 5.4.0, so this
also re-bundles the previously-merged 5.4.x source fixes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rickbutterfield rickbutterfield force-pushed the v5/bugfix/300-rte-nested-preview branch from 5401972 to c465172 Compare June 30, 2026 14:50
@rickbutterfield rickbutterfield merged commit f2520d9 into v5/dev Jun 30, 2026
4 checks passed
@rickbutterfield rickbutterfield deleted the v5/bugfix/300-rte-nested-preview branch June 30, 2026 14:54
rickbutterfield added a commit that referenced this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant