Skip to content

Commit

Permalink
fix image insert console error (#3634)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladanost authored and youknowriad committed Nov 27, 2017
1 parent 14aa86b commit f51ec08
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blocks/library/image/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class ImageBlock extends Component {
}

onSelectImage( media ) {
this.props.setAttributes( { url: media.url, alt: media.alt, caption: media.caption, id: media.id } );
const attributes = { url: media.url, alt: media.alt, id: media.id };
if ( media.caption ) {
attributes.caption = [ media.caption ];
}
this.props.setAttributes( attributes );
}

onSetHref( value ) {
Expand Down

0 comments on commit f51ec08

Please sign in to comment.