Closed
Description
Hello all,
I am creating a new style for gallery block. It is working as expected but it does not require any default gallery controls present in the Gallery Settings Panel. I want to hide these controls whenever the style is selected.
I figured that its gonna use the editor.BlockEdit
filter. I referred to the example in the handbook but I cannot figure out how to make the Panel hide using the filter. This is my code as of now-
const { Fragment } = wp.element;
const { addFilter } = wp.hooks;
const { InspectorControls } = wp.editor;
const { createHigherOrderComponent } = wp.compose;
const hideGalleryControls = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
const { attributes } = props;
return (
<Fragment>
<BlockEdit {...props} />
<InspectorControls>
{
"is-style-custom" === attributes.className &&
//Don't know what to do here
}
</InspectorControls>
</Fragment>
);
}
}, 'hideGalleryControls' );
addFilter(
'editor.BlockEdit',
'custom/hideGallery',
hideGalleryControls
);
Any help would be appreciated!