[MOOSE-373] FE: Add MediaImageControl Component#340
Open
GeoffDusome wants to merge 2 commits intomainfrom
Open
[MOOSE-373] FE: Add MediaImageControl Component#340GeoffDusome wants to merge 2 commits intomainfrom
MediaImageControl Component#340GeoffDusome wants to merge 2 commits intomainfrom
Conversation
dpellenwood
approved these changes
Apr 1, 2026
Collaborator
dpellenwood
left a comment
There was a problem hiding this comment.
🍏 Lovely improvement!
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this do/fix?
Introduces a reusable
MediaImageControlfor the block editor sidebar and refactors the image card and image overlay card blocks to use it, so image pick/preview/replace/remove behavior lives in one place.What changed
MediaImageControl(assets/js/components/MediaImageControl.js) — Featured-image–style UI: choose image, preview (withResponsiveWrapperwhen dimensions exist), replace/remove actions, loading spinner +VisuallyHiddentext, missing-attachment messaging, and inline layout styles so editor polish stays in the component file (no new stylesheet).useBlockMedia(assets/js/hooks/useBlockMedia.js) — Subscribes to attachment data viagetEntityRecord( 'postType', 'attachment', … )andhasFinishedResolution, matching core’s direction instead of the legacygetMediashortcut; exposesmedia,isLoading,isMissing, andhasResolved.image-cardandimage-overlay-card— Removed duplicatedMediaUpload/withSelectboilerplate; each block keepsonSelect/onRemove+mediaIdand delegates UI toMediaImageControl.hooksresolve alias pointing atassets/js/hooks(same idea as the existingcomponentsalias).Why
QA
Links to relevant issues
Screenshots/video:
Dev Environment URL:
Pull request checklist