react-code-dataset / wp-calypso /apps /wpcom-block-editor /src /wpcom /features /deprecate-coblocks-buttons.js
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
Raw History Blame Contribute Delete
589 Bytes
import { getBlockType, registerBlockType, unregisterBlockType } from '@wordpress/blocks';
import domReady from '@wordpress/dom-ready';
/**
* Prevents the CoBlocks Buttons block from being insertable.
*/
function deprecateCoBlocksButtonsSettings() {
const coBlocksButtons = getBlockType( 'coblocks/buttons' );
if ( ! coBlocksButtons ) {
return;
}
unregisterBlockType( 'coblocks/buttons' );
registerBlockType( 'coblocks/buttons', {
...coBlocksButtons,
supports: {
...coBlocksButtons.supports,
inserter: false,
},
} );
}
domReady( deprecateCoBlocksButtonsSettings );