@@ -44,7 +44,7 @@ function PatternOverridesControls( {
44
44
45
45
const hasName = ! ! attributes . metadata ?. name ;
46
46
const defaultBindings = attributes . metadata ?. bindings ?. __default ;
47
- const allowOverrides =
47
+ const hasOverrides =
48
48
hasName && defaultBindings ?. source === PATTERN_OVERRIDES_BINDING_SOURCE ;
49
49
const isConnectedToOtherSources =
50
50
defaultBindings ?. source &&
@@ -79,13 +79,14 @@ function PatternOverridesControls( {
79
79
blockName === 'core/image' &&
80
80
( ! ! attributes . caption ?. length || ! ! attributes . href ?. length ) ;
81
81
82
- const helpText = hasUnsupportedImageAttributes
83
- ? __ (
84
- `Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.`
85
- )
86
- : __ (
87
- 'Allow changes to this block throughout instances of this pattern.'
88
- ) ;
82
+ const helpText =
83
+ ! hasOverrides && hasUnsupportedImageAttributes
84
+ ? __ (
85
+ `Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.`
86
+ )
87
+ : __ (
88
+ 'Allow changes to this block throughout instances of this pattern.'
89
+ ) ;
89
90
90
91
return (
91
92
< >
@@ -101,16 +102,18 @@ function PatternOverridesControls( {
101
102
variant = "secondary"
102
103
aria-haspopup = "dialog"
103
104
onClick = { ( ) => {
104
- if ( allowOverrides ) {
105
+ if ( hasOverrides ) {
105
106
setShowDisallowOverridesModal ( true ) ;
106
107
} else {
107
108
setShowAllowOverridesModal ( true ) ;
108
109
}
109
110
} }
110
- disabled = { hasUnsupportedImageAttributes }
111
+ disabled = {
112
+ ! hasOverrides && hasUnsupportedImageAttributes
113
+ }
111
114
__experimentalIsFocusable
112
115
>
113
- { allowOverrides
116
+ { hasOverrides
114
117
? __ ( 'Disable overrides' )
115
118
: __ ( 'Enable overrides' ) }
116
119
</ Button >
0 commit comments