You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extend MediaReplaceFlow with additional options (toolbar icon, clear media) #34663
I love that I have been able to use a premade component to handle adding & replacing media in my custom blocks, but the customization is a little bit lacking:
I can change the text of the toolbar button, but I can't set a custom icon with label. I have a custom block that handles 2 images, a background and a foreground, so the toolbar gets really long with "Replace Background" and "Replace Foreground" in it.
There is no option in the provided dropdown to clear the selected media. It would be really handy to include a "Clear Media" option under "Open Media Library" and "Upload" if an image is currently selected (which the MediaReplaceFlow component already knows about). I see that where this component is currently used (like the cover block), an extra setting has to be added in the sidebar to clear media.
What is your proposed solution?
Add an icon prop to MediaReplaceFlow that, when defined, inserts an icon with label (using the name property) into the ToolbarButton.
Add a "Clear Media" option in the dropdown if mediaID/mediaURL is not null/undefined. The onSelect callback set by the user should receive undefined (I think).
Looks like both parts of this have landed. #64826 added Reset through onReset, and #68084 added renderToggle for custom toolbar controls. Both are still in the current component, so I think we can close this one. Please reopen if there's still an extension point missing here.
Activity
priethor commentedon Aug 7, 2026
Looks like both parts of this have landed. #64826 added Reset through
onReset, and #68084 addedrenderTogglefor custom toolbar controls. Both are still in the current component, so I think we can close this one. Please reopen if there's still an extension point missing here.