Skip to content

Commit 8d471bc

Browse files
committed
Add edit button, still not working
1 parent 1e7b8a7 commit 8d471bc

File tree

1 file changed

+43
-20
lines changed

1 file changed

+43
-20
lines changed

assets/src/js/bindings/block-editor.js

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,49 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
165165
initialOpen={ true }
166166
>
167167
{ bindableAttributes.map( ( attribute ) => (
168-
<PanelRow key={ `scf-field-${ attribute }` }>
169-
<ComboboxControl
170-
__next40pxDefaultSize
171-
__nextHasNoMarginBottom
172-
__experimentalShowHowTo={ false }
173-
__experimentalExpandOnFocus={ true }
174-
__experimentalAutoSelectFirstMatch={ true }
175-
label={ attribute }
176-
placeholder={ __(
177-
'Select a field',
178-
'secure-custom-fields'
179-
) }
180-
options={ fieldsSuggestions }
181-
value={ boundFields[ attribute ] || '' }
182-
onChange={ ( value ) =>
183-
handleFieldChange( attribute, value )
184-
}
185-
key={ `scf-field-${ attribute }` }
186-
/>
187-
</PanelRow>
168+
<>
169+
<PanelRow key={ `scf-field-${ attribute }` }>
170+
<ComboboxControl
171+
__next40pxDefaultSize
172+
__nextHasNoMarginBottom
173+
__experimentalShowHowTo={ false }
174+
__experimentalExpandOnFocus={ true }
175+
__experimentalAutoSelectFirstMatch={
176+
true
177+
}
178+
label={ attribute }
179+
placeholder={ __(
180+
'Select a field',
181+
'secure-custom-fields'
182+
) }
183+
options={ fieldsSuggestions }
184+
value={ boundFields[ attribute ] || '' }
185+
onChange={ ( value ) =>
186+
handleFieldChange(
187+
attribute,
188+
value
189+
)
190+
}
191+
key={ `scf-field-${ attribute }` }
192+
/>
193+
</PanelRow>
194+
{ boundFields[ attribute ] && (
195+
<PanelRow>
196+
<Button
197+
onClick={ () => {
198+
console.log( 'edit' );
199+
} }
200+
__next40pxDefaultSize
201+
variant="secondary"
202+
>
203+
{ __(
204+
'Edit field',
205+
'secure-custom-fields'
206+
) }
207+
</Button>
208+
</PanelRow>
209+
) }
210+
</>
188211
) ) }
189212
<PanelRow>
190213
<Button

0 commit comments

Comments
 (0)