Skip to content

Commit

Permalink
Fix gallery items parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jul 7, 2017
1 parent 4dc462c commit 332e295
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion blocks/library/gallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { pick } from 'lodash';
*/
import './style.scss';
import './block.scss';
import { registerBlockType } from '../../api';
import { registerBlockType, query as hpq } from '../../api';
import MediaUploadButton from '../../media-upload-button';
import InspectorControls from '../../inspector-controls';
import RangeControl from '../../inspector-controls/range-control';
Expand All @@ -20,6 +20,8 @@ import BlockAlignmentToolbar from '../../block-alignment-toolbar';
import GalleryImage from './gallery-image';
import BlockDescription from '../../block-description';

const { query, attr } = hpq;

const MAX_COLUMNS = 8;

const editMediaLibrary = ( attributes, setAttributes ) => {
Expand Down Expand Up @@ -70,6 +72,13 @@ registerBlockType( 'core/gallery', {
icon: 'format-gallery',
category: 'common',

attributes: {
images: query( '.blocks-gallery-image', {
url: attr( 'img', 'src' ),
alt: attr( 'img', 'alt' )
} )
},

getEditWrapperProps( attributes ) {
const { align } = attributes;
if ( 'left' === align || 'right' === align || 'wide' === align || 'full' === align ) {
Expand Down

0 comments on commit 332e295

Please sign in to comment.