Skip to content

Commit

Permalink
Made SiteLogoReplaceFlow always available
Browse files Browse the repository at this point in the history
+ show "Reset" when there is a logo uploaded
  • Loading branch information
richtabor committed Jul 22, 2024
1 parent f130e99 commit 089de65
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,20 @@ const SiteLogo = ( {

// This is a light wrapper around MediaReplaceFlow because the block has two
// different MediaReplaceFlows, one for the inspector and one for the toolbar.
function SiteLogoReplaceFlow( { onRemoveLogo, ...mediaReplaceProps } ) {
function SiteLogoReplaceFlow( {
mediaURL,
onRemoveLogo,
...mediaReplaceProps
} ) {
return (
<MediaReplaceFlow
{ ...mediaReplaceProps }
allowedTypes={ ALLOWED_MEDIA_TYPES }
accept={ ACCEPT_MEDIA_STRING }
>
<MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>
{ mediaURL && (
<MenuItem onClick={ onRemoveLogo }>{ __( 'Reset' ) }</MenuItem>
) }
</MediaReplaceFlow>
);
}
Expand Down Expand Up @@ -520,11 +526,12 @@ export default function LogoEdit( {

const mediaReplaceFlowProps = {
mediaURL: logoUrl,
name: ! logoUrl ? __( 'Choose Site Logo' ) : __( 'Replace' ),
onSelect: onSelectLogo,
onError: onUploadError,
onRemoveLogo,
};
const controls = canUserEdit && logoUrl && ! temporaryURL && (
const controls = (
<BlockControls group="other">
<SiteLogoReplaceFlow { ...mediaReplaceFlowProps } />
</BlockControls>
Expand Down

0 comments on commit 089de65

Please sign in to comment.