这让我开始了。
使用设置块create-guten-block
Gitub
使现代化block.js
例如:
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,
});