[create-product-editor-block] Fix product editor block registration (#44194)

* Use registerProductEditorBlockType

* Changelog

* Update changelog to provide more detail
This commit is contained in:
Matt Sherman 2024-02-05 15:59:39 -05:00 committed by GitHub
parent 113a7caa7d
commit 7e7b78f943
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 15 deletions

View File

@ -1,27 +1,23 @@
/**
* External dependencies
*/
import { BlockConfiguration, registerBlockType } from '@wordpress/blocks';
import { registerProductEditorBlockType } from '@woocommerce/product-editor';
/**
* Internal dependencies
*/
import './editor.scss'; // see https://www.npmjs.com/package/@wordpress/scripts#using-css
/**
* Internal dependencies
*/
import blockConfiguration from './block.json';
import { Edit } from './edit';
import metadata from './block.json';
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
*/
registerBlockType( metadata as BlockConfiguration, {
/**
* @see ./edit.js
*/
const { name, ...metadata } = blockConfiguration;
const settings = {
edit: Edit,
};
registerProductEditorBlockType( {
name,
metadata: metadata as never,
settings: settings as never,
} );

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Example uses registerProductEditorBlockType to register block so that functionality such as hideConditions and disableConditions work with block.