Skip to content

Commit

Permalink
fix util
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 14, 2023
1 parent 221f43f commit 657b509
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/block-editor/src/hooks/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,27 +545,27 @@ export function createBlockListBlockFilter( features ) {
}

export function createBlockSaveFilter( features ) {
function extraPropsFromHooks( props ) {
function extraPropsFromHooks( props, name, attributes ) {
features.reduce( ( accu, feature ) => {
const { hasSupport, attributeKeys = [], addSaveProps } = feature;

const neededProps = {};
for ( const key of attributeKeys ) {
if ( props.attributes[ key ] ) {
neededProps[ key ] = props.attributes[ key ];
if ( attributes[ key ] ) {
neededProps[ key ] = attributes[ key ];
}
}

if (
// Skip rendering if none of the needed attributes are
// set.
! Object.keys( neededProps ).length ||
! hasSupport( props.name )
! hasSupport( name )
) {
return accu;
}

return addSaveProps( accu, props.name, neededProps );
return addSaveProps( accu, name, neededProps );
}, props );
}
addFilter(
Expand Down

0 comments on commit 657b509

Please sign in to comment.