When I have define( 'SCRIPT_DEBUG', true );
In my wp-config.php
, I receive the correct object from calling this hook: editor.BlockListBlock
. When I have define( 'SCRIPT_DEBUG', false );
or not defined, I receive the wrong object.
const { createHigherOrderComponent } = wp.compose;
const withClientIdClassName = createHigherOrderComponent( ( BlockListBlock ) => {
// BlockListBlock returns as "WithSelect" with debug off
// and returns as the correct component with debug on
console.log(BlockListBlock);
return ( props ) => {
const {attributes, name} = props;
if(name === 'project/block-name'){
return <BlockListBlock { ...props } className={'classes-i-want-on-this'} />;
} else {
return <BlockListBlock { ...props } />;
}
};
}, 'withClientIdClassName' );
wp.hooks.addFilter( 'editor.BlockListBlock', 'classNames-for-cells', withClientIdClassName );
With SCRIPT_DEBUG not defined or false
With SCRIPT_DEBUG true
I used this to start up my project https://github.com/ahmadawais/create-guten-block