From 92f4e295f65e94f937cbb704e25a5d9c9dd3338c Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 17 May 2017 15:32:41 +0100 Subject: [PATCH] Heading Block: Fix Text To Heading block --- blocks/library/heading/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/blocks/library/heading/index.js b/blocks/library/heading/index.js index 6f5ae5cfd1f2d..e8f8753af03f9 100644 --- a/blocks/library/heading/index.js +++ b/blocks/library/heading/index.js @@ -1,3 +1,8 @@ +/** + * External dependencies + */ +import { isString } from 'lodash'; + /** * Internal dependencies */ @@ -38,8 +43,11 @@ registerBlock( 'core/heading', { blocks: [ 'core/text' ], transform: ( { content, ...attrs } ) => { if ( Array.isArray( content ) ) { + const headingContent = isString( content[ 0 ] ) + ? content[ 0 ] + : content[ 0 ].props.children; const heading = createBlock( 'core/heading', { - content: content[ 0 ].props.children, + content: headingContent, } ); const blocks = [ heading ];