[Document Editor] Render areabrick previewHtml in the areablock brick picker - #4014
Merged
Merged
Conversation
… 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).
Contributor
There was a problem hiding this comment.
Pull request overview
Adds sanitized areabrick previews to the document editor’s brick-picker tooltips, addressing issue #272.
Changes:
- Renders
previewHtmlthroughSanitizeHtml. - 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes pimcore/platform-version#272
Problem
Areabricks implementing
Pimcore\Extension\Document\Areabrick\PreviewAwareInterfacenever get theirpreviewHtmldisplayed in the Studio UI areablock "add brick" picker. The backend sends the value (EditableHandler::getAvailableAreablockAreas()) and the frontend types it (AreaType.previewHtml), butuse-areablock-menu.tsxrendered onlynameanddescription.Fix
Show the preview in the menu entry's tooltip — the same surface the classic admin UI used (
Ext.tip.ToolTipwith the brick's preview HTML). WhenpreviewHtmlis present, the tooltip stacks the translated description (if any) above the preview, rendered through the existingSanitizeHtmlcomponent (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.