[create-product-editor-block] Fix product editor block registration (#44194)
* Use registerProductEditorBlockType * Changelog * Update changelog to provide more detail
This commit is contained in:
parent
113a7caa7d
commit
7e7b78f943
|
@ -1,27 +1,23 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { BlockConfiguration, registerBlockType } from '@wordpress/blocks';
|
import { registerProductEditorBlockType } from '@woocommerce/product-editor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
import './editor.scss'; // see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
import './editor.scss'; // see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
||||||
|
import blockConfiguration from './block.json';
|
||||||
/**
|
|
||||||
* Internal dependencies
|
|
||||||
*/
|
|
||||||
import { Edit } from './edit';
|
import { Edit } from './edit';
|
||||||
import metadata from './block.json';
|
|
||||||
|
|
||||||
/**
|
const { name, ...metadata } = blockConfiguration;
|
||||||
* Every block starts by registering a new block type definition.
|
|
||||||
*
|
const settings = {
|
||||||
* @see https://developer.wordpress.org/block-editor/developers/block-api/#registering-a-block
|
|
||||||
*/
|
|
||||||
registerBlockType( metadata as BlockConfiguration, {
|
|
||||||
/**
|
|
||||||
* @see ./edit.js
|
|
||||||
*/
|
|
||||||
edit: Edit,
|
edit: Edit,
|
||||||
|
};
|
||||||
|
|
||||||
|
registerProductEditorBlockType( {
|
||||||
|
name,
|
||||||
|
metadata: metadata as never,
|
||||||
|
settings: settings as never,
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -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.
|
Loading…
Reference in New Issue