Skip to content

Commit

Permalink
Heading Block: Fix Text To Heading block
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 23, 2017
1 parent 3b2d42f commit 92f4e29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion blocks/library/heading/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import { isString } from 'lodash';

/**
* Internal dependencies
*/
Expand Down Expand Up @@ -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 ];

Expand Down

0 comments on commit 92f4e29

Please sign in to comment.