Skip to content

Commit

Permalink
Merge pull request #2341 from WordPress/fix/cover-image-modified-exte…
Browse files Browse the repository at this point in the history
…rnally

Cover Image: Extract title as children array (fix "modified externally")
  • Loading branch information
aduth authored Aug 10, 2017
2 parents 6cf5da1 + ce77f24 commit fae7483
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions blocks/library/cover-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import InspectorControls from '../../inspector-controls';
import ToggleControl from '../../inspector-controls/toggle-control';
import BlockDescription from '../../block-description';

const { text } = source;
const { children } = source;

const validAlignments = [ 'left', 'center', 'right', 'wide', 'full' ];

Expand All @@ -32,8 +32,8 @@ registerBlockType( 'core/cover-image', {

attributes: {
title: {
type: 'string',
source: text( 'h2' ),
type: 'array',
source: children( 'h2' ),
},
url: {
type: 'string',
Expand Down
4 changes: 3 additions & 1 deletion blocks/test/fixtures/core__cover-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"name": "core/cover-image",
"isValid": true,
"attributes": {
"title": "Guten Berg!",
"title": [
"Guten Berg!"
],
"url": "https://cldup.com/uuUqE_dXzy.jpg",
"hasParallax": false,
"hasBackgroundDim": true
Expand Down

0 comments on commit fae7483

Please sign in to comment.