Skip to content

Commit

Permalink
Fixed image block description when no url present (#3756)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathiu authored and jorgefilipecosta committed Dec 4, 2017
1 parent 7efa54c commit ff9c02a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions blocks/library/image/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ class ImageBlock extends Component {
const uploadFromFiles = ( event ) => mediaUpload( event.target.files, setAttributes );
const dropFiles = ( files ) => mediaUpload( files, setAttributes );

const blockDescription = (
<BlockDescription>
<p>{ __( 'Worth a thousand words.' ) }</p>
</BlockDescription>
);

const controls = (
focus && (
<BlockControls key="controls">
Expand Down Expand Up @@ -152,6 +158,11 @@ class ImageBlock extends Component {
if ( ! url ) {
return [
controls,
focus && (
<InspectorControls key="inspector">
{ blockDescription }
</InspectorControls>
),
<Placeholder
key="placeholder"
instructions={ __( 'Drag image here or insert from media library' ) }
Expand Down Expand Up @@ -194,9 +205,7 @@ class ImageBlock extends Component {
controls,
focus && (
<InspectorControls key="inspector">
<BlockDescription>
<p>{ __( 'Worth a thousand words.' ) }</p>
</BlockDescription>
{ blockDescription }
<h3>{ __( 'Image Settings' ) }</h3>
<TextControl label={ __( 'Textual Alternative' ) } value={ alt } onChange={ this.updateAlt } help={ __( 'Describe the purpose of the image. Leave empty if the image is not a key part of the content.' ) } />
{ ! isEmpty( availableSizes ) && (
Expand Down

0 comments on commit ff9c02a

Please sign in to comment.