Skip to content

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmussen committed Jul 5, 2018
1 parent d4cd16e commit 41b3db4
Showing 1 changed file with 38 additions and 8 deletions.
46 changes: 38 additions & 8 deletions core-blocks/image/index.js
Expand Up @@ -217,25 +217,55 @@ export const settings = {
/>
);

const figure = (
<figure className={ classes }>
{ href ? <a href={ href }>{ image }</a> : image }
{ caption && caption.length > 0 && <RichText.Content tagName="figcaption" value={ caption } /> }
</figure>
);

if ( 'left' === align || 'right' === align ) {
return (
<aside>
<figure className={ classes }>
{ href ? <a href={ href }>{ image }</a> : image }
{ caption && caption.length > 0 && <RichText.Content tagName="figcaption" value={ caption } /> }
</figure>
{ figure }
</aside>
);
}

return (
<figure className={ classes }>
{ href ? <a href={ href }>{ image }</a> : image }
{ caption && caption.length > 0 && <RichText.Content tagName="figcaption" value={ caption } /> }
</figure>
{ figure }
);
},

deprecated: [
{
attributes: blockAttributes,
save( { attributes } ) {
const { url, alt, caption, align, href, width, height, id } = attributes;

const classes = classnames( {
[ `align${ align }` ]: align,
'is-resized': width || height,
} );

const image = (
<img
src={ url }
alt={ alt }
className={ id ? `wp-image-${ id }` : null }
width={ width }
height={ height }
/>
);

return (
<figure className={ classes }>
{ href ? <a href={ href }>{ image }</a> : image }
{ caption && caption.length > 0 && <RichText.Content tagName="figcaption" value={ caption } /> }
</figure>
);
},
},
{
attributes: blockAttributes,
save( { attributes } ) {
Expand Down

0 comments on commit 41b3db4

Please sign in to comment.