Gutenberg example for creating sidebar https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/plugin-sidebar-0/ does not keep what is entered in the box. After refreshing the page, entered content is gone end text box is empty. I guess it is some kind of REST problem?
I just checked, when updating post, meta field is sent via POST request, therefore it is not a REST problem:
{"meta":{"sidebar_plugin_meta_block_field":"Jozica1"},"content":" ... etc
PHP Code:
add_action( 'init', function () {
if (is_admin()) {
wp_register_script( 'gmk-sidebar-js', get_template_directory_uri() . '/js/sidebar-panel.js',
[ 'wp-plugins', 'wp-edit-post', 'wp-element', 'wp-components', 'wp-data' ]
);
wp_register_style( 'gmk-sidebar-style', get_template_directory_uri() . '/css/admin-guten-sidebar.css' );
register_post_meta( '', 'sidebar_plugin_meta_block_field', array(
'show_in_rest' => true,
'single' => true,
'type' => 'string',
) );
}
} );