Single Product Block: avoid to register incompatibility blocks with the Single Product Block on the post/page editor (https://github.com/woocommerce/woocommerce-blocks/pull/10044)
This commit is contained in:
parent
6a35063dd1
commit
cf8b73d79f
|
@ -30,4 +30,5 @@ registerBlockSingleProductTemplate( {
|
|||
blockName: metadata.name,
|
||||
blockMetadata: metadata,
|
||||
blockSettings,
|
||||
isAvailableOnPostEditor: true,
|
||||
} );
|
||||
|
|
|
@ -25,6 +25,6 @@ registerBlockSingleProductTemplate( {
|
|||
),
|
||||
},
|
||||
edit,
|
||||
ancestor: [ 'woocommerce/single-product' ],
|
||||
},
|
||||
isAvailableOnPostEditor: false,
|
||||
} );
|
||||
|
|
|
@ -19,6 +19,6 @@ registerBlockSingleProductTemplate( {
|
|||
icon,
|
||||
// @ts-expect-error `edit` can be extended to include other attributes
|
||||
edit,
|
||||
ancestor: [ 'woocommerce/single-product' ],
|
||||
},
|
||||
isAvailableOnPostEditor: false,
|
||||
} );
|
||||
|
|
|
@ -29,4 +29,5 @@ registerBlockSingleProductTemplate( {
|
|||
},
|
||||
ancestor: [ 'woocommerce/single-product' ],
|
||||
},
|
||||
isAvailableOnPostEditor: true,
|
||||
} );
|
||||
|
|
|
@ -15,6 +15,6 @@ registerBlockSingleProductTemplate( {
|
|||
blockMetadata: metadata,
|
||||
blockSettings: {
|
||||
edit,
|
||||
ancestor: [ 'woocommerce/single-product' ],
|
||||
},
|
||||
isAvailableOnPostEditor: false,
|
||||
} );
|
||||
|
|
|
@ -30,4 +30,5 @@ registerBlockSingleProductTemplate( {
|
|||
blockName: 'woocommerce/product-rating',
|
||||
blockMetadata: metadata,
|
||||
blockSettings: blockConfig,
|
||||
isAvailableOnPostEditor: true,
|
||||
} );
|
||||
|
|
|
@ -19,6 +19,6 @@ registerBlockSingleProductTemplate( {
|
|||
icon,
|
||||
edit,
|
||||
save,
|
||||
ancestor: [ 'woocommerce/single-product' ],
|
||||
},
|
||||
isAvailableOnPostEditor: false,
|
||||
} );
|
||||
|
|
|
@ -26,10 +26,12 @@ export const registerBlockSingleProductTemplate = ( {
|
|||
blockSettings,
|
||||
isVariationBlock = false,
|
||||
variationName,
|
||||
isAvailableOnPostEditor,
|
||||
}: {
|
||||
blockName: string;
|
||||
blockMetadata: Partial< BlockConfiguration >;
|
||||
blockSettings: Partial< BlockConfiguration >;
|
||||
isAvailableOnPostEditor: boolean;
|
||||
isVariationBlock?: boolean;
|
||||
variationName?: string;
|
||||
} ) => {
|
||||
|
@ -97,7 +99,7 @@ export const registerBlockSingleProductTemplate = ( {
|
|||
// This subscribe callback could be invoked with the core/blocks store
|
||||
// which would cause infinite registration loops because of the `registerBlockType` call.
|
||||
// This local cache helps prevent that.
|
||||
if ( ! isBlockRegistered ) {
|
||||
if ( ! isBlockRegistered && isAvailableOnPostEditor ) {
|
||||
if ( isVariationBlock ) {
|
||||
blocksRegistered.add( variationName );
|
||||
registerBlockVariation(
|
||||
|
|
Loading…
Reference in New Issue