Skip to content

Commit

Permalink
Fix paste attributes after #1902
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Aug 15, 2017
1 parent f1d9f67 commit 5d64877
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
10 changes: 8 additions & 2 deletions blocks/library/heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ registerBlockType( 'core/heading', {
type: 'raw',
source: ( node ) => /H\d/.test( node.nodeName ),
attributes: {
content: children( 'h1,h2,h3,h4,h5,h6' ),
nodeName: prop( 'h1,h2,h3,h4,h5,h6', 'nodeName' ),
content: {
type: 'array',
source: children( 'h1,h2,h3,h4,h5,h6' ),
},
nodeName: {
type: 'string',
source: prop( 'h1,h2,h3,h4,h5,h6', 'nodeName' ),
},
},
},
{
Expand Down
15 changes: 12 additions & 3 deletions blocks/library/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,18 @@ registerBlockType( 'core/image', {
( ! node.textContent && node.querySelector( 'img' ) )
),
attributes: {
url: attr( 'img', 'src' ),
alt: attr( 'img', 'alt' ),
caption: children( 'figcaption' ),
url: {
type: 'string',
source: attr( 'img', 'src' ),
},
alt: {
type: 'string',
source: attr( 'img', 'alt' ),
},
caption: {
type: 'array',
source: children( 'figcaption' ),
},
},
},
],
Expand Down
11 changes: 9 additions & 2 deletions blocks/library/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ registerBlockType( 'core/list', {
type: 'raw',
source: ( node ) => node.nodeName === 'OL' || node.nodeName === 'UL',
attributes: {
nodeName: prop( 'ol,ul', 'nodeName' ),
values: children( 'ol,ul' ),
nodeName: {
type: 'string',
source: prop( 'ol,ul', 'nodeName' ),
},
values: {
type: 'array',
source: children( 'ol,ul' ),
default: [],
},
},
},
{
Expand Down
5 changes: 4 additions & 1 deletion blocks/library/paragraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ registerBlockType( 'core/paragraph', {
! node.querySelector( 'audio, canvas, embed, iframe, img, math, object, svg, video' )
),
attributes: {
content: children( 'p' ),
content: {
type: 'array',
source: children( 'p' ),
},
},
},
],
Expand Down

0 comments on commit 5d64877

Please sign in to comment.