Skip to content

Commit ffa345b

Browse files
committed
Make some cleaning
1 parent 8493b04 commit ffa345b

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { store as editorStore } from '@wordpress/editor';
2525
*/
2626
import BlockAttributesControlLinkedButton from './components/block-attributes-control-linked-button';
2727

28+
// These constant and the function above have been copied from Gutenberg. It should be public, eventually.
29+
2830
const BLOCK_BINDINGS_ALLOWED_BLOCKS = {
2931
'core/paragraph': [ 'content' ],
3032
'core/heading': [ 'content' ],
@@ -49,6 +51,7 @@ function getBindableAttributes( blockName ) {
4951
const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
5052
return ( props ) => {
5153
const bindableAttributes = getBindableAttributes( props.name );
54+
const showLinkedButton = props.name === 'core/image';
5255
const { updateBlockBindings, removeAllBlockBindings } =
5356
useBlockBindingsUtils();
5457

@@ -81,7 +84,6 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
8184

8285
const currentBindings = props.attributes?.metadata?.bindings || {};
8386

84-
// Memoize the fields transformation to prevent unnecessary recalculations
8587
const fields = useMemo(
8688
() =>
8789
fieldsGroups?.reduce( ( acc, fieldGroup ) => {
@@ -98,7 +100,7 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
98100
}, [] ) || [],
99101
[ fieldsGroups ]
100102
);
101-
// Memoize the fieldsSuggestions to avoid recreating on every render
103+
102104
const fieldsSuggestions = useMemo( () => {
103105
if ( props.name === 'core/image' ) {
104106
// return only the type image fields
@@ -151,7 +153,7 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
151153
// Memoize the change handler to prevent creating new function on each render
152154
const handleFieldChange = useCallback(
153155
( attributes, value ) => {
154-
// Ensure attributes is always an array
156+
// Ensure attributes is always an array.
155157
const attributeArray = Array.isArray( attributes )
156158
? attributes
157159
: [ attributes ];
@@ -171,7 +173,7 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
171173
};
172174
} );
173175

174-
// Update all bindings at once
176+
// Update all bindings at once.
175177
updateBlockBindings( bindings );
176178

177179
return newState;
@@ -195,7 +197,6 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
195197
[ updateBlockBindings ]
196198
);
197199

198-
// Handle reset for ToolsPanel
199200
const handleReset = useCallback( () => {
200201
removeAllBlockBindings();
201202
setBoundFields( {} );
@@ -216,7 +217,7 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
216217
) }
217218
resetAll={ handleReset }
218219
>
219-
{ 'core/image' === props.name && (
220+
{ showLinkedButton && (
220221
<HStack
221222
justify="space-between"
222223
align="center"
@@ -335,7 +336,6 @@ const withCustomControls = createHigherOrderComponent( ( BlockEdit ) => {
335336
};
336337
}, 'withCustomControls' );
337338

338-
// Only register the filter if the connect_fields beta feature is enabled
339339
if ( window.scf?.betaFeatures?.connect_fields ) {
340340
addFilter(
341341
'editor.BlockEdit',

assets/src/sass/_forms.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,4 @@ p.submit .acf-spinner {
313313
margin: 0;
314314
}
315315
}
316-
}
317-
318-
.scf-field-token-field {
319-
margin-bottom: 2em;
320316
}

secure-custom-fields.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ function scf_plugin_deactivated_notice() {
878878
function scf_plugin_uninstall() {
879879
// List of known beta features.
880880
$beta_features = array(
881-
'editor_sidebar',
882881
'connect_fields',
883882
);
884883

0 commit comments

Comments
 (0)