Skip to content

Commit

Permalink
Introduce Editable.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Jul 10, 2017
1 parent 47c8e18 commit 71d8e19
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
16 changes: 15 additions & 1 deletion blocks/library/gallery/gallery-image.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
/**
* WordPress dependencies
*/
import { __ } from 'i18n';

/**
* Internal dependencies
*/
import Editable from '../../editable';

export default function GalleryImage( props ) {
return (
<figure className="blocks-gallery-image" onClick={ props.onSelect }>
<img src={ props.img.url } alt={ props.img.alt } />
{ props.focus &&
<figcaption>Add caption...</figcaption>
<Editable
tagName="figcaption"
placeholder={ __( 'Write caption…' ) }
focus={ props.focus }
inlineToolbar
/>
}
</figure>
);
Expand Down
10 changes: 10 additions & 0 deletions blocks/library/gallery/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@
.blocks-gallery__placeholder-instructions {
margin: 1.8em 0;
}

.wp-block-gallery .blocks-editable {
position: absolute;
bottom: 0;
left: 0;
right: 0;
figcaption {
position: static;
}
}

0 comments on commit 71d8e19

Please sign in to comment.