editor.BlockListBlock Filter not passing BlockListBlock to Function

406 views Asked by At

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

enter image description here

With SCRIPT_DEBUG true

enter image description here

I used this to start up my project https://github.com/ahmadawais/create-guten-block

0

There are 0 answers