Skip to content

Commit

Permalink
Quote Block: Fix transforming an empty quote block to text
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jun 26, 2017
1 parent 7144d3e commit 5cdee57
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion blocks/library/quote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ registerBlockType( 'core/quote', {
type: 'block',
blocks: [ 'core/text' ],
transform: ( { value, citation, ...attrs } ) => {
const textElement = Array.isArray( value ) ? value[ 0 ] : value;
const textElement = value[ 0 ];
if ( ! textElement ) {
return createBlock( 'core/text', {
content: citation,
} );
}
const textContent = isString( textElement ) ? textElement : textElement.props.children;
if ( Array.isArray( value ) || citation ) {
const text = createBlock( 'core/text', {
Expand Down

0 comments on commit 5cdee57

Please sign in to comment.