diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index 29c865687ab087..613ab643df1d98 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -404,6 +404,7 @@ export default function Image( { const { lockUrlControls = false, + lockHrefControls = false, lockAltControls = false, lockTitleControls = false, } = useSelect( @@ -416,6 +417,7 @@ export default function Image( { unlock( select( blockEditorStore ) ); const { url: urlBinding, + href: hrefBinding, alt: altBinding, title: titleBinding, } = metadata?.bindings || {}; @@ -423,8 +425,12 @@ export default function Image( { getBlockParentsByBlockName( clientId, 'core/block' ).length > 0; return { lockUrlControls: - ( !! urlBinding && - getBlockBindingsSource( urlBinding?.source ) + !! urlBinding && + getBlockBindingsSource( urlBinding?.source ) + ?.lockAttributesEditing === true, + lockHrefControls: + ( !! hrefBinding && + getBlockBindingsSource( hrefBinding?.source ) ?.lockAttributesEditing === true ) || // Disable editing the link of the URL if the image is inside a pattern instance. // This is a temporary solution until we support overriding the link on the frontend. @@ -445,21 +451,23 @@ export default function Image( { const controls = ( <> - { isSingleSelected && ! isEditingImage && ! lockUrlControls && ( - - ) } + { isSingleSelected && + ! isEditingImage && + ! lockHrefControls && ( + + ) } { allowCrop && ( setIsEditingImage( true ) }