diff --git a/blocks/library/heading/index.js b/blocks/library/heading/index.js index 6b08226990a4a..40870e58d437f 100644 --- a/blocks/library/heading/index.js +++ b/blocks/library/heading/index.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { isString, isObject } from 'lodash'; +import { isObject } from 'lodash'; /** * WordPress dependencies @@ -44,9 +44,9 @@ registerBlockType( 'core/heading', { transform: ( { content, ...attrs } ) => { const isMultiParagraph = Array.isArray( content ) && isObject( content[ 0 ] ) && content[ 0 ].type === 'p'; if ( isMultiParagraph ) { - const headingContent = isString( content[ 0 ] ) - ? content[ 0 ] - : content[ 0 ].props.children; + const headingContent = isObject( content[ 0 ] ) && content[ 0 ].type === 'p' + ? content[ 0 ].props.children + : content[ 0 ]; const heading = createBlock( 'core/heading', { content: headingContent, } ); diff --git a/blocks/library/quote/index.js b/blocks/library/quote/index.js index 7c84044af0e0d..9cf3496a8a68b 100644 --- a/blocks/library/quote/index.js +++ b/blocks/library/quote/index.js @@ -90,7 +90,9 @@ registerBlockType( 'core/quote', { transform: ( { value, citation, ...attrs } ) => { const isMultiParagraph = Array.isArray( value ) && isObject( value[ 0 ] ) && value[ 0 ].type === 'p'; const headingElement = isMultiParagraph ? value[ 0 ] : value; - const headingContent = isString( headingElement ) ? headingElement : headingElement.props.children; + const headingContent = isObject( headingElement ) && value[ 0 ].type === 'p' + ? headingElement.props.children + : headingElement; if ( isMultiParagraph || citation ) { const heading = createBlock( 'core/heading', { content: headingContent,