diff --git a/extensions/shared/components/block-styles-selector/index.js b/extensions/shared/components/block-styles-selector/index.js index b798f76a2d7d6..c1be47a0df001 100644 --- a/extensions/shared/components/block-styles-selector/index.js +++ b/extensions/shared/components/block-styles-selector/index.js @@ -13,6 +13,16 @@ import { BlockPreview } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; import { ENTER, SPACE } from '@wordpress/keycodes'; +const addPreviewAttribute = block => { + return { + ...block, + attributes: { + ...block.attributes, + __isBlockPreview: true, + }, + }; +}; + const StylePreview = ( { attributes, styleOption, viewportWidth, blockName } ) => { const type = getBlockType( blockName ); @@ -20,14 +30,14 @@ const StylePreview = ( { attributes, styleOption, viewportWidth, blockName } ) =
); diff --git a/extensions/shared/get-validated-attributes.js b/extensions/shared/get-validated-attributes.js index 6b668998ebaf0..01635b9fc7192 100644 --- a/extensions/shared/get-validated-attributes.js +++ b/extensions/shared/get-validated-attributes.js @@ -14,6 +14,9 @@ export const getValidatedAttributes = ( attributeDetails, attributesToValidate ) reduce( attributesToValidate, ( ret, attribute, attributeKey ) => { + if ( undefined === attributeDetails[ attributeKey ] ) { + return ret; + } const { type, validator, validValues, default: defaultVal } = attributeDetails[ attributeKey ]; diff --git a/extensions/shared/wrap-paid-block.jsx b/extensions/shared/wrap-paid-block.jsx index febfc9f0f99cb..1a861821b42fd 100644 --- a/extensions/shared/wrap-paid-block.jsx +++ b/extensions/shared/wrap-paid-block.jsx @@ -14,7 +14,9 @@ export default ( { requiredPlan } ) => WrappedComponent => props => ( // Wraps the input component in a container, without mutating it. Good! - + { ( ! props?.attributes?.__isBlockPreview ?? false ) && ( + + ) } ),