Adding pre-publish checks with Gutenberg

This got me started.

Set up the block with create-guten-block Gitub

Update block.js to something like:

import './style.scss';
import './editor.scss';

var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
var registerPlugin = wp.plugins.registerPlugin;

function Component() {
    wp.data.dispatch('core/editor').lockPostSaving()
    //do stuff
    //wp.data.dispatch('core/editor').unlockPostSaving()
    return wp.element.createElement(
        PluginPrePublishPanel,
        {   
            className: 'my-plugin-publish-panel',
            title: 'Panel title',
            initialOpen: true,
        },  
        'Panel content'
    );  
}

registerPlugin( 'my-plugin', {
  render: Component,
});

Leave a Comment