plugin development - Adding pre-publish checks with Gutenberg

Before publishing an unpublished article pre-publish checks are shown.How can I extend this programmatically, and disabl

Before publishing an unpublished article pre-publish checks are shown.

How can I extend this programmatically, and disable the publish button if the checks are not passed?

Before publishing an unpublished article pre-publish checks are shown.

How can I extend this programmatically, and disable the publish button if the checks are not passed?

Share Improve this question asked Apr 11, 2019 at 12:29 ChristopherDBerryChristopherDBerry 1817 bronze badges 1
  • 1 I added an example on how to do this here -wordpress.stackexchange/questions/339138/… – Welcher Commented Jan 10, 2020 at 15:25
Add a comment  | 

1 Answer 1

Reset to default 4

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,
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745577262a4634041.html

相关推荐

  • plugin development - Adding pre-publish checks with Gutenberg

    Before publishing an unpublished article pre-publish checks are shown.How can I extend this programmatically, and disabl

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信