Is there a core Sortable component in Gutenberg?
Is there a core Sortable component in Gutenberg?
Is there a core Sortable component in Gutenberg?
How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
Actually an assumption I made in the question was wrong; The update button doesn’t only change when the output of the save function changes. It also changes when the attributes are changed. However I found a small bug, which you can’t really see it in the provided code. In my BlockSettings component I was using … Read more
The meta value is read when the block loads and assigned to the block attribute. Changes to the block will update the attribute and when the post saves the value will save to the meta. So, as far as I understood, there is no need to actually save anything in the registerBlockType js function. The … Read more
Very similar to your goal, I recently wanted to add a block-style to all existing blocks. I found that upon loading an editor page, I must wait for the WP editor JS data to populate before adding my styles, and AFAIK, there’s no callback hook for this. So I chose to add a not-so-elegant delay … Read more
The handle() method is being called by an add_action(‘enqueue_block_editor_assets, [$block, ‘handle’]) method along with all the other blocks. Here lies the problem. The register_block_type is being called too late. Try to call the function inside the init action hook. You can see an example in the shortcode block of the core.
The issue is that in ToggleControl you are using the wrong prop for the value. It should be checked instead of value. Also use the blockEditor package instead of editor for InspectorControls as it will be deprecated. el( ToggleControl, { label: ‘Toogle’, checked: props.attributes.toggle, // here onChange: ( value ) => { props.setAttributes( { toggle: … Read more
Some of the panels related to the entire post (e.g. the featured image, excerpt) can be removed and https://github.com/WordPress/gutenberg/issues/17281 shows how. e.g. wp.data.dispatch( ‘core/edit-post’).removeEditorPanel( ‘featured-image’ ); wp.data.dispatch( ‘core/edit-post’).removeEditorPanel( ‘post-excerpt’ ); The sidebar is also used for additional block options and there’s currently no cohesive, consistent way to manage whether a block’s options are available to … Read more
It is not possible to query multiple post types simultaneously using the getEntityRecords() selector. This is because the WordPress REST API is not built around the same ideology as the core WordPress back-end. All data-types being “posts” in the traditional PHP APIs is the product of the somewhat controversial underlying database implementation, while the REST … Read more
This happens in serialize_block_attributes, the docblock explains why: /** … * The serialized result is a JSON-encoded string, with unicode escape sequence * substitution for characters which might otherwise interfere with embedding * the result in an HTML comment. … */ So this is done as an encoding measure to avoid attributes accidentally closing a … Read more