Skip to content

[Document Editor] Render areabrick previewHtml in the areablock brick picker - #4014

Merged
kingjia90 merged 7 commits into
2026.2from
fix/pv272-areabrick-preview-html
Aug 26, 2026
Merged

kingjia90 merged 7 commits into
2026.2from
fix/pv272-areabrick-preview-html

Conversation

@kingjia90

Copy link
Copy Markdown
Contributor

Fixes pimcore/platform-version#272

Problem

Areabricks implementing Pimcore\Extension\Document\Areabrick\PreviewAwareInterface never get their previewHtml displayed in the Studio UI areablock "add brick" picker. The backend sends the value (EditableHandler::getAvailableAreablockAreas()) and the frontend types it (AreaType.previewHtml), but use-areablock-menu.tsx rendered only name and description.

Fix

Show the preview in the menu entry's tooltip — the same surface the classic admin UI used (Ext.tip.ToolTip with the brick's preview HTML). When previewHtml is present, the tooltip stacks the translated description (if any) above the preview, rendered through the existing SanitizeHtml component (DOMPurify) instead of raw injection, so we're stricter than classic. Both menu branches (flat and grouped) now share one item builder.

No BC break, no API change — purely additive rendering of an already-delivered config value.

… picker

The backend passes previewHtml (PreviewAwareInterface) in the areablock
editable config and AreaType already types it, but the menu only rendered
name and description. Show the sanitized preview HTML in the entry tooltip,
matching the classic admin UI behavior (ToolTip with the brick preview).
Copilot AI balanced review requested due to automatic review settings August 21, 2026 09:13
@kingjia90 kingjia90 self-assigned this Aug 21, 2026
@kingjia90 kingjia90 added this to the 2026.2.7 milestone Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds sanitized areabrick previews to the document editor’s brick-picker tooltips, addressing issue #272.

Changes:

  • Renders previewHtml through SanitizeHtml.
  • Shares menu-item construction across flat and grouped menus.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jcPimcore jcPimcore modified the milestones: 2026.2.7, 2026.2.8 Aug 25, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kingjia90 kingjia90 added the Bug label Aug 26, 2026
kingjia90 and others added 4 commits August 26, 2026 10:10
Combine the previewHtml tooltip (shared toMenuItem builder) with the
tooltip z-index fix from #4003: the zIndex prop now sits on the single
shared Tooltip. build-dist conflict resolved to our zip; CI rebuilds it.
Covers: sanitized preview rendering (img kept, onerror/script stripped),
description stacking, null/undefined/empty fallback to plain description,
absent tooltip when nothing is set, and the grouped-menu branch.
@sonarqubecloud

Copy link
Copy Markdown

@kingjia90
kingjia90 merged commit d982052 into 2026.2 Aug 26, 2026
16 checks passed
@kingjia90
kingjia90 deleted the fix/pv272-areabrick-preview-html branch August 26, 2026 15:14
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants