Gutenberg Block add element in the Editor inside InnerBlocks after div – editor-block-list

I want to wrap the InnerBlocks content in the editor with a custom React Element, but it is not rendering as I need it. My code (simplified): edit: ( props ) => { const { attributes: { options, otherAttributes, }, setAttributes, className } = props; return ( <div className={`${options} ${otherAttributes}`} > <MyElement> <InnerBlocks /> </MyElement> … Read more

Gutenberg Reusable Block as part of WordPress Theme page

I’m using WordPress “Twenty Nineteen” (child) theme. What I’m trying to achieve is to include one of my previously created Gutenberg Reusable Blocks as part of theme’s index.php file. The reason for that is to be able to quickly and easily edit what’s displayed at the begginig of the homepage, right above the list of … Read more

Remove WordPress/Gutenberg button styles for ACF blocks

Is there a way to remove the default styling of the gutenberg editor? I am building a custom theme using ACF blocks, part of one of the blocks has a button that is being displayed from the template file. <button type=”button” class=”button”>Button Text</button> Everything on the front end looks fine and my styles for “.button” … Read more

Is it possible to bulk migrate all deprecated instances of a gutenberg block?

I wrote a plugin which defines a gutenberg block. After using this block in posts, I’ve changed its definition inside my plugin, so now I have a “deprecated” entry in the block configuration containing “migrate” function. I can open and save each post containing this block and the migration is applied. Is it possible to … Read more

Gutenberg: useDispatch is not a function – @wordpress/data included

I have the @wordpress/data package installed, but I can’t use useDispatch in my block edit function: const { registerBlockType } = wp.blocks; const { useDispatch, useSelect } = wp.data; . . . registerBlockType( ‘rb-bootstrap/grid’, { … edit: function( props ) { const { replaceInnerBlocks } = useDispatch(“core/block-editor”); } } TypeError: useDispatch is not a function … Read more

Gutenberg List Extension Block

I’m trying to extend the default Gutenberg unordered list that renders like this; <ul> <li>Item 1</li> <li>Item 2</li> </ul> To something like this when it has a custom list style attribute selected; <ul> <li><span></span>Item 1</li> <li><span></span>Item 2</li> </ul> To do this I started setting up an extension with some custom attributes like this; // Set … Read more

Block editor: How to check if block editor has initialized and populated the data store?

Within some JavaScript I have to get the current post content of Gutenberg. I am accessing this from jQuery (might be bad practice, however): $(document).ready(function() { const { select } = wp.data; var currentPost = select(“core/editor”).getCurrentPost(); }); Within this construct the content of currentPost is undefined. Within: $(document).ready(function() { setTimeout(function(){ const { select } = … Read more