I am making an attempt to create a brand new panel within the edit-post sidebar (WordPress Gutenberg), I already managed to set the panel with the title and the textual content within the content material half however I want so as to add a button there and no I discover a strategy to do it.
var registerPlugin = wp.plugins.registerPlugin;
var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
// var btn = wp.aspect.createElement( 'button' );
var el = wp.aspect.createElement;
var __ = wp.i18n.__;
/* I attempted to do it with a perform, but it surely did not work
perform setButton() {
btn.innerHTML = 'Submit';
btn.kind="submit";
btn.identify="formBtn";
btn.onclick = perform () {
alert( 'Button is clicked');
};
}
********************************************************/
perform MyDocumentSettingPlugin() {
return el(
PluginDocumentSettingPanel,
{
identify: 'my-document-setting-plugin',
title: 'My Panel',
icon: 'dashicon-name',
},
__( 'My Doc Setting Panel Content material', 'text-domain' ),
// setButton(), <---------- I want so as to add a button right here
);
}
registerPlugin( 'my-document-setting-plugin', {
render: MyDocumentSettingPlugin,
} );
Please assist :/