Set default image link target in Gutenberg image block

I want to set the default target of the image block in Gutenberg to “Media File”: I’ve found solutions for the classic editor, and one that appears to work for Gutenberg galleries by editing the block’s template, but I was under the impression that the intended way to modify the editor’s behaviour is via JavaScript … Read more

Running Gutenberg React in Development Mode

Is there a way to enable WordPress to run the non-minified version of React while developing Gutenberg blocks? I am receiving an error from React while learning to create Gutenberg blocks. react-dom.min.b75d8b30.js:62 Error: Minified React error #130; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful … Read more

How to filter or remove default panels in Gutenberg PrePublish Panel

I would like to edit the text or remove and re-create the Publish panel of Gutenberg’s PrePublish Panel in the editor sidebar. I know I can use wp.data.dispatch( ‘core/edit-post’ ).removeEditorPanel( ‘example-panel’ ); but it doesn’t seem to work for any panels in editor-post-publish-panel. Any ideas? The background is that I used the slotfill API to … Read more

How to add a custom CSS class to core blocks in Gutenberg editor?

I’m trying to add a class to list blocks (core/list) in Gutenberg. Unfortunately, it looks like because some blocks like lists and paragraphs don’t have the standard default class name of wp-block-{name} they can’t be renamed using the blocks.getBlockDefaultClassName filter. To get around that, I’ve used the blocks.getSaveContent.extraProps filter, which seems to enable me to … Read more

Add pre-publish conditions to the block editor

The introduction of the Block Editor killed all plugins which offered publishing conditions, such as minimum word counts, featured image requirements etc. But the Block Editor did introduce the pre-publish checks: Beautiful. How can we disable the Publish button until a set amount of conditions have been fulfilled? Examples of four (very) different conditions: Minimum … Read more

check if Gutenberg is currently in use

How can I check if the editor that is currently being used is Gutenberg in a WordPress plugin? I need this because Gutenberg lacks post_submitbox_misc_actions, so I need a fallback which will only be used if the current editor is Gutenberg. 8 Necessary API Functions/Methods: You’ll need WP_Screen::is_block_editor() method to check if you are currently … Read more