Skip to content

Commit

Permalink
Restrict getFieldsList API
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Sep 30, 2024
1 parent 3d36af7 commit 1fbfde4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/blocks/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ function getMergedUsesContext( existingUsesContext = [], newUsesContext = [] ) {
export function blockBindingsSources( state = {}, action ) {
switch ( action.type ) {
case 'ADD_BLOCK_BINDINGS_SOURCE':
// Only open this API in Gutenberg and for `core/post-meta` for the moment.
let getFieldsList;
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
getFieldsList = action.getFieldsList;
} else if ( action.name === 'core/post-meta' ) {
getFieldsList = action.getFieldsList;
}
return {
...state,
[ action.name ]: {
Expand All @@ -407,7 +414,7 @@ export function blockBindingsSources( state = {}, action ) {
// Only set `canUserEditValue` if `setValues` is also defined.
canUserEditValue:
action.setValues && action.canUserEditValue,
getFieldsList: action.getFieldsList,
getFieldsList,
},
};
case 'ADD_BOOTSTRAPPED_BLOCK_BINDINGS_SOURCE':
Expand Down

0 comments on commit 1fbfde4

Please sign in to comment.