I am adding a PluginSidebar
to Gutenberg and it works until I try to add a meta field to the sidebar. Then it doesn't work. I'm not sure why though.
import { registerPlugin } from "@wordpress/plugins";
import { PluginSidebar, PluginSidebarMoreMenuItem } from "@wordpress/edit-post";
import { __ } from "@wordpress/i18n";
import { PanelBody, ToggleControl } from '@wordpress/components';
registerPlugin( 'page-layout-plugin', {
icon: 'smiley',
render: ( props ) => {
return (
<PluginSidebar
name="meta-page-settings"
title="Gutenberg Settings Sidebar"
>
<ToggleControl
label={__('Show Sidebar?', 'starter')}
checked={props.attributes.showSidebarAttribute}
onChange={(val) => props.setAttributes({showSidebarAttribute: val})}
/>
</PluginSidebar>
)
}
} );
This is the code before compiling it. The error I am getting it below. I read that we can create the attribute name to be saved so I'm not sure why it isn't working. Any help would be greatly appreciated.