Skip to content

Commit

Permalink
Only pass context included in usesContext from block bindings (Word…
Browse files Browse the repository at this point in the history
…Press#65618)

- Only pass context included in `usesContext`

Co-authored-by: SantosGuillamot <[email protected]>
Co-authored-by: gziolo <[email protected]>
  • Loading branch information
3 people authored Sep 25, 2024
1 parent 4e53371 commit a080200
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,17 @@ export function RichTextWrapper(
const blockBindingsSource = getBlockBindingsSource(
relatedBinding.source
);
const blockBindingsContext = {};
if ( blockBindingsSource?.usesContext?.length ) {
for ( const key of blockBindingsSource.usesContext ) {
blockBindingsContext[ key ] = blockContext[ key ];
}
}

const _disableBoundBlock =
! blockBindingsSource?.canUserEditValue?.( {
select,
context: blockContext,
context: blockBindingsContext,
args: relatedBinding.args,
} );

Expand All @@ -201,7 +207,7 @@ export function RichTextWrapper(
const blockAttributes = getBlockAttributes( clientId );
const fieldsList = blockBindingsSource?.getFieldsList?.( {
registry,
context: blockContext,
context: blockBindingsContext,
} );
const bindingKey =
fieldsList?.[ relatedBinding?.args?.key ]?.label ??
Expand Down

0 comments on commit a080200

Please sign in to comment.