diff --git a/packages/block-editor/src/hooks/use-bindings-attributes.js b/packages/block-editor/src/hooks/use-bindings-attributes.js index a7ff6818e74a9c..89f28116c5e37e 100644 --- a/packages/block-editor/src/hooks/use-bindings-attributes.js +++ b/packages/block-editor/src/hooks/use-bindings-attributes.js @@ -231,9 +231,8 @@ export const withBlockBindingSupport = createHigherOrderComponent( ) && Object.keys( keptAttributes ).length ) { - // Don't update caption and href until they are supported. + // Don't update href until they are supported. if ( hasPatternOverridesDefaultBinding ) { - delete keptAttributes?.caption; delete keptAttributes?.href; } setAttributes( keptAttributes ); diff --git a/packages/block-library/src/image/image.js b/packages/block-library/src/image/image.js index 3e5dace6d23dbc..741ec5bb0ada3c 100644 --- a/packages/block-library/src/image/image.js +++ b/packages/block-library/src/image/image.js @@ -454,7 +454,6 @@ export default function Image( { lockAltControlsMessage, lockTitleControls = false, lockTitleControlsMessage, - lockCaption = false, hideCaptionControls = false, } = useSelect( ( select ) => { @@ -491,10 +490,6 @@ export default function Image( { // 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. hasParentPattern || arePatternOverridesEnabled, - lockCaption: - // Disable editing the caption if the image is inside a pattern instance. - // This is a temporary solution until we support overriding the caption on the frontend. - hasParentPattern, lockAltControls: !! altBinding && ! altBindingSource?.canUserEditValue( { @@ -1002,10 +997,9 @@ export default function Image( { label={ __( 'Image caption text' ) } showToolbarButton={ isSingleSelected && - hasNonContentControls && - ! arePatternOverridesEnabled + ( hasNonContentControls || isContentOnlyMode ) && + ! hideCaptionControls } - readOnly={ lockCaption } /> ); diff --git a/packages/patterns/src/components/pattern-overrides-controls.js b/packages/patterns/src/components/pattern-overrides-controls.js index b8af8538d8b358..b2cd2b5cdcb935 100644 --- a/packages/patterns/src/components/pattern-overrides-controls.js +++ b/packages/patterns/src/components/pattern-overrides-controls.js @@ -76,13 +76,12 @@ function PatternOverridesControls( { } const hasUnsupportedImageAttributes = - blockName === 'core/image' && - ( !! attributes.caption?.length || !! attributes.href?.length ); + blockName === 'core/image' && !! attributes.href?.length; const helpText = ! hasOverrides && hasUnsupportedImageAttributes ? __( - `Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.` + `Overrides currently don't support image links. Remove the link first before enabling overrides.` ) : __( 'Allow changes to this block throughout instances of this pattern.'