I’ve a hook that add further knowledge attributes to a few of my allowed blocks. The issues is the info attributes aren’t exhibiting on the frontend for post-title block. Within the editor every little thing is okay however not on the save perform. I am assuming that this hooks is not going to work for save perform that’s created dynamically. How can I go these attributes to my allowedblocks inc. core/post-title ?
const addMarginPaddingDataAttributesToFrontEnd = (
props,
block,
attributes
) => {
if ( ! allowedBlocks.consists of( block.title ) ) {
return props;
}
const margins = prepareDataString( attributes.margins );
const paddings = prepareDataString( attributes.paddings );
const newAttributes = {};
if ( margins !== '' ) {
newAttributes[ 'data-margin' ] = margins;
}
if ( paddings !== '' ) {
newAttributes[ 'data-padding' ] = paddings;
}
return assign( props, newAttributes );
};
addFilter(
'blocks.getSaveContent.extraProps',
'customized/save-data-attributes',
addMarginPaddingDataAttributesToFrontEnd
);