Skip to content

Commit

Permalink
Move default value to reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Feb 9, 2024
1 parent fd32d62 commit 79a42c5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ export function RichTextWrapper(
if (
blockTypeAttributes?.[ attribute ]?.source ===
'rich-text' &&
getBlockBindingsSource( args.source )
?.lockAttributesEditing !== false
getBlockBindingsSource( args.source )?.lockAttributesEditing
) {
shouldDisableEditing = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@ function blockBindingsSources( state = {}, action ) {
[ action.sourceName ]: {
label: action.sourceLabel,
useSource: action.useSource,
lockAttributesEditing: action.lockAttributesEditing,
lockAttributesEditing: action.lockAttributesEditing ?? true,
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function ButtonEdit( props ) {
lockUrlControls:
!! metadata?.bindings?.url &&
getBlockBindingsSource( metadata?.bindings?.url?.source )
?.lockAttributesEditing !== false,
?.lockAttributesEditing,
};
},
[ isSelected ]
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export function ImageEdit( {
lockUrlControls:
!! metadata?.bindings?.url &&
getBlockBindingsSource( metadata?.bindings?.url?.source )
?.lockAttributesEditing !== false,
?.lockAttributesEditing,
};
},
[ isSingleSelected ]
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,19 @@ export default function Image( {
lockUrlControls:
!! urlBinding &&
getBlockBindingsSource( urlBinding?.source )
?.lockAttributesEditing !== false,
?.lockAttributesEditing,
lockHrefControls:
// 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,
lockAltControls:
!! altBinding &&
getBlockBindingsSource( altBinding?.source )
?.lockAttributesEditing !== false,
?.lockAttributesEditing,
lockTitleControls:
!! titleBinding &&
getBlockBindingsSource( titleBinding?.source )
?.lockAttributesEditing !== false,
?.lockAttributesEditing,
};
},
[ clientId, isSingleSelected, metadata?.bindings ]
Expand Down

0 comments on commit 79a42c5

Please sign in to comment.