From 332e2959ff85c0a35a15ff0b148e84d95f06d5d0 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 7 Jul 2017 17:11:26 +0200 Subject: [PATCH 1/3] Fix gallery items parsing --- blocks/library/gallery/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blocks/library/gallery/index.js b/blocks/library/gallery/index.js index 3cd6c3b41af19..4bbb6383be2fb 100644 --- a/blocks/library/gallery/index.js +++ b/blocks/library/gallery/index.js @@ -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'; @@ -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 ) => { @@ -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 ) { From 2c92696a197797058de166d771738475f15f66ee Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Sat, 8 Jul 2017 08:46:38 +0200 Subject: [PATCH 2/3] Revert "Fix gallery items parsing" This reverts commit 332e2959ff85c0a35a15ff0b148e84d95f06d5d0. --- blocks/library/gallery/index.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/blocks/library/gallery/index.js b/blocks/library/gallery/index.js index 4bbb6383be2fb..3cd6c3b41af19 100644 --- a/blocks/library/gallery/index.js +++ b/blocks/library/gallery/index.js @@ -10,7 +10,7 @@ import { pick } from 'lodash'; */ import './style.scss'; import './block.scss'; -import { registerBlockType, query as hpq } from '../../api'; +import { registerBlockType } from '../../api'; import MediaUploadButton from '../../media-upload-button'; import InspectorControls from '../../inspector-controls'; import RangeControl from '../../inspector-controls/range-control'; @@ -20,8 +20,6 @@ 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 ) => { @@ -72,13 +70,6 @@ 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 ) { From 8a71aef37fecfc42f7b589529d433a6295e9eefc Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Sat, 8 Jul 2017 08:52:10 +0200 Subject: [PATCH 3/3] Include images attribute in serialized gallery content --- post-content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post-content.js b/post-content.js index 9a840d5096672..9488323716bc1 100644 --- a/post-content.js +++ b/post-content.js @@ -131,7 +131,7 @@ window._wpGutenbergPost = { }', '', - '', + '', '