From 5d6487766eff6980dc2ee80827fd607fea550695 Mon Sep 17 00:00:00 2001 From: iseulde Date: Mon, 14 Aug 2017 18:20:06 +0200 Subject: [PATCH] Fix paste attributes after #1902 --- blocks/library/heading/index.js | 10 ++++++++-- blocks/library/image/index.js | 15 ++++++++++++--- blocks/library/list/index.js | 11 +++++++++-- blocks/library/paragraph/index.js | 5 ++++- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/blocks/library/heading/index.js b/blocks/library/heading/index.js index ff673288bc65f2..493697fd23bb55 100644 --- a/blocks/library/heading/index.js +++ b/blocks/library/heading/index.js @@ -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' ), + }, }, }, { diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js index c52e584e6cebbf..26b6aaf1eeb487 100644 --- a/blocks/library/image/index.js +++ b/blocks/library/image/index.js @@ -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' ), + }, }, }, ], diff --git a/blocks/library/list/index.js b/blocks/library/list/index.js index 8de0508ff6057d..4977f4ef6dae90 100644 --- a/blocks/library/list/index.js +++ b/blocks/library/list/index.js @@ -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: [], + }, }, }, { diff --git a/blocks/library/paragraph/index.js b/blocks/library/paragraph/index.js index 57dfa2b42e1bf3..880cb72f64aede 100644 --- a/blocks/library/paragraph/index.js +++ b/blocks/library/paragraph/index.js @@ -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' ), + }, }, }, ],