diff --git a/blocks/api/matchers.js b/blocks/api/matchers.js
index 0ccf4cf8d8832..bc9239f495b38 100644
--- a/blocks/api/matchers.js
+++ b/blocks/api/matchers.js
@@ -1,15 +1,14 @@
/**
- * WordPress dependencies
+ * External dependencies
*/
-import { createElement } from '@wordpress/element';
+export { attr, prop, html, text, query } from 'hpq';
/**
- * External dependencies
+ * Internal dependencies
*/
-import { nodeListToReact, nodeToReact } from 'dom-react';
-export { attr, prop, html, text, query } from 'hpq';
+import { createSimpleNode, createSimpleNodeList } from './simple-dom';
-export const children = ( selector ) => {
+export const children = ( selector, filter ) => {
return ( domNode ) => {
let match = domNode;
@@ -18,14 +17,14 @@ export const children = ( selector ) => {
}
if ( match ) {
- return nodeListToReact( match.childNodes || [], createElement );
+ return createSimpleNodeList( match.childNodes || [], filter );
}
return [];
};
};
-export const node = ( selector ) => {
+export const node = ( selector, filter ) => {
return ( domNode ) => {
let match = domNode;
@@ -33,6 +32,6 @@ export const node = ( selector ) => {
match = domNode.querySelector( selector );
}
- return nodeToReact( match, createElement );
+ return createSimpleNode( match, filter );
};
};
diff --git a/blocks/api/simple-dom.js b/blocks/api/simple-dom.js
new file mode 100644
index 0000000000000..9dae20126cf4f
--- /dev/null
+++ b/blocks/api/simple-dom.js
@@ -0,0 +1,65 @@
+/**
+ * External dependencies
+ */
+import { forEach } from 'lodash';
+
+export function createSimpleNode( node, filter = Array ) {
+ if ( ! node ) {
+ return null;
+ }
+
+ if ( node.nodeType === 3 ) {
+ return node.nodeValue;
+ }
+
+ if ( node.nodeType !== 1 ) {
+ return null;
+ }
+
+ return filter(
+ node.nodeName.toLowerCase(),
+ Array.from( node.attributes || [] ).reduce( ( acc, { name, value } ) => ( {
+ ...acc,
+ [ name ]: value,
+ } ), {} ),
+ ...createSimpleNodeList( node.childNodes || [], filter )
+ );
+}
+
+export function createSimpleNodeList( nodeList, filter ) {
+ return Array.from( nodeList ).reduce( ( acc, node ) => {
+ const child = createSimpleNode( node, filter );
+
+ if ( Array.isArray( child ) && typeof child[ 0 ] !== 'string' ) {
+ acc.push( ...child );
+ } else if ( child ) {
+ acc.push( child );
+ }
+
+ return acc;
+ }, [] );
+}
+
+// Smarter application in the future?
+export function applySimpleNodeList( tree, node ) {
+ while ( node.firstChild ) {
+ node.removeChild( node.firstChild );
+ }
+
+ forEach( tree, ( piece ) => {
+ if ( typeof piece === 'string' ) {
+ node.appendChild( document.createTextNode( piece ) );
+ } else {
+ const [ name, attributes, ...children ] = piece;
+ const element = document.createElement( name );
+
+ forEach( attributes, ( value, key ) => {
+ element.setAttribute( key, value );
+ } );
+
+ applySimpleNodeList( children, element );
+
+ node.appendChild( element );
+ }
+ } );
+}
diff --git a/blocks/api/test/matchers.js b/blocks/api/test/matchers.js
index 32d1246a2e9d6..f8adbcb70b13f 100644
--- a/blocks/api/test/matchers.js
+++ b/blocks/api/test/matchers.js
@@ -11,12 +11,15 @@ import { renderToString } from '@wordpress/element';
/**
* Internal dependencies
*/
-import * as sources from '../matchers';
+import Editable from '../../editable';
+import * as matchers from '../matchers';
describe( 'matchers', () => {
+ const html = '
A delicious sundae dessert.
I want it!
';
+
describe( 'children()', () => {
it( 'should return a source function', () => {
- const source = sources.children();
+ const source = matchers.children();
expect( typeof source ).toBe( 'function' );
} );
@@ -24,16 +27,17 @@ describe( 'matchers', () => {
it( 'should return HTML equivalent WPElement of matched element', () => {
// Assumption here is that we can cleanly convert back and forth
// between a string and WPElement representation
- const html = 'A delicious sundae dessert
';
- const match = parse( html, sources.children() );
+ const match = parse( html, matchers.children() );
- expect( renderToString( match ) ).toBe( html );
+ expect(
+ renderToString( )
+ ).toBe( html );
} );
} );
describe( 'node()', () => {
it( 'should return a source function', () => {
- const source = sources.node();
+ const source = matchers.node();
expect( typeof source ).toBe( 'function' );
} );
@@ -41,10 +45,13 @@ describe( 'matchers', () => {
it( 'should return HTML equivalent WPElement of matched element', () => {
// Assumption here is that we can cleanly convert back and forth
// between a string and WPElement representation
- const html = 'A delicious sundae dessert
';
- const match = parse( html, sources.node() );
+ const match = parse( html, matchers.node() );
- expect( renderToString( match ) ).toBe( `${ html }` );
+ expect(
+ renderToString( )
+ ).toBe(
+ `${ html }`
+ );
} );
} );
} );
diff --git a/blocks/editable/index.js b/blocks/editable/index.js
index 10de33f38900e..f313f0bfedd9c 100644
--- a/blocks/editable/index.js
+++ b/blocks/editable/index.js
@@ -14,13 +14,12 @@ import {
defer,
noop,
} from 'lodash';
-import { nodeListToReact } from 'dom-react';
import 'element-closest';
/**
* WordPress dependencies
*/
-import { createElement, Component, renderToString } from '@wordpress/element';
+import { createElement, Component } from '@wordpress/element';
import { keycodes, createBlobURL } from '@wordpress/utils';
import { Slot, Fill } from '@wordpress/components';
@@ -29,6 +28,8 @@ import { Slot, Fill } from '@wordpress/components';
*/
import './style.scss';
import { rawHandler } from '../api';
+import * as matchers from '../api/matchers';
+import { applySimpleNodeList } from '../api/simple-dom';
import FormatToolbar from './format-toolbar';
import TinyMCE from './tinymce';
import { pickAriaProps } from './aria';
@@ -37,7 +38,10 @@ import { EVENTS } from './constants';
const { BACKSPACE, DELETE, ENTER } = keycodes;
-function createTinyMCEElement( type, props, ...children ) {
+const createNode = matchers.node( null, nodeFilter );
+const createChildren = matchers.children( null, nodeFilter );
+
+function nodeFilter( type, props, ...children ) {
if ( props[ 'data-mce-bogus' ] === 'all' ) {
return null;
}
@@ -46,11 +50,11 @@ function createTinyMCEElement( type, props, ...children ) {
return children;
}
- return createElement(
+ return [
type,
- omitBy( props, ( value, key ) => key.indexOf( 'data-mce-' ) === 0 ),
- ...children
- );
+ omitBy( props, ( value, key ) => key.indexOf( 'data-mce-' ) === 0 || key === 'key' ),
+ ...children,
+ ];
}
function isLinkBoundary( fragment ) {
@@ -72,6 +76,39 @@ function getFormatProperties( formatName, parents ) {
const DEFAULT_FORMATS = [ 'bold', 'italic', 'strikethrough', 'link' ];
+/**
+ * Transforms internal block's representation into an Element.
+ *
+ * @param {Array} value Value to transform
+ * @return {WPElement} Element.
+ */
+function valueToElement( value ) {
+ if ( ! Array.isArray( value ) ) {
+ return value;
+ }
+
+ return value.map( ( element, i ) => {
+ if ( typeof element === 'string' ) {
+ return element;
+ }
+
+ const [ type, props, ...children ] = element;
+ const reactProps = Object.keys( props ).reduce( ( accumulator, key ) => {
+ const mapping = {
+ class: 'className',
+ for: 'htmlFor',
+ };
+
+ return {
+ ...accumulator,
+ [ mapping[ key ] ? mapping[ key ] : key ]: props[ key ],
+ };
+ }, { key: i } );
+
+ return createElement( type, { ...reactProps }, ...valueToElement( children ) );
+ } );
+}
+
export default class Editable extends Component {
constructor( props ) {
super( ...arguments );
@@ -547,8 +584,8 @@ export default class Editable extends Component {
const index = dom.nodeIndex( selectedNode );
const beforeNodes = childNodes.slice( 0, index );
const afterNodes = childNodes.slice( index + 1 );
- const beforeElement = nodeListToReact( beforeNodes, createTinyMCEElement );
- const afterElement = nodeListToReact( afterNodes, createTinyMCEElement );
+ const beforeElement = beforeNodes.map( createNode );
+ const afterElement = afterNodes.map( createNode );
this.setContent( beforeElement );
this.props.onSplit( beforeElement, afterElement );
@@ -602,8 +639,8 @@ export default class Editable extends Component {
const beforeFragment = beforeRange.extractContents();
const afterFragment = afterRange.extractContents();
- const beforeElement = nodeListToReact( beforeFragment.childNodes, createTinyMCEElement );
- const afterElement = isLinkBoundary( afterFragment ) ? [] : nodeListToReact( afterFragment.childNodes, createTinyMCEElement );
+ const beforeElement = createChildren( beforeFragment );
+ const afterElement = isLinkBoundary( afterFragment ) ? [] : createChildren( afterFragment );
this.setContent( beforeElement );
this.props.onSplit( beforeElement, afterElement, ...blocks );
@@ -656,8 +693,8 @@ export default class Editable extends Component {
this.setContent( this.props.value );
this.props.onSplit(
- nodeListToReact( before, createTinyMCEElement ),
- nodeListToReact( after, createTinyMCEElement )
+ before.map( createNode ),
+ after.map( createNode )
);
}
@@ -687,17 +724,12 @@ export default class Editable extends Component {
this.editor.save();
}
- setContent( content ) {
- if ( ! content ) {
- content = '';
- }
-
- content = renderToString( content );
- this.editor.setContent( content, { format: 'raw' } );
+ setContent( content = [] ) {
+ applySimpleNodeList( content, this.editor.getBody() );
}
getContent() {
- return nodeListToReact( this.editor.getBody().childNodes || [], createTinyMCEElement );
+ return createChildren( this.editor.getBody() );
}
updateFocus() {
@@ -850,7 +882,7 @@ export default class Editable extends Component {
getSettings={ this.getSettings }
onSetup={ this.onSetup }
style={ style }
- defaultValue={ value }
+ defaultValue={ valueToElement( value ) }
isPlaceholderVisible={ isPlaceholderVisible }
aria-label={ placeholder }
{ ...ariaProps }
@@ -879,3 +911,5 @@ Editable.defaultProps = {
formattingControls: DEFAULT_FORMATS,
formatters: [],
};
+
+Editable.Value = ( { value } ) => valueToElement( value );
diff --git a/blocks/editable/test/index.js b/blocks/editable/test/index.js
index 8213fbf8e700c..263475300a8aa 100644
--- a/blocks/editable/test/index.js
+++ b/blocks/editable/test/index.js
@@ -150,4 +150,47 @@ describe( 'Editable', () => {
} );
} );
} );
+
+ describe( 'Editable.Value', () => {
+ const MyComponent = ( { value } ) => (
+
+
+
+ );
+
+ it( 'should render value containing string', () => {
+ const value = [ 'Hello, Dolly!' ];
+ const wrapper = shallow( );
+
+ expect( wrapper.html() ).toBe( 'Hello, Dolly!
' );
+ } );
+
+ it( 'should render value containing a single DOM node', () => {
+ const value = [
+ [ 'h1', { class: 'my-class' }, 'This is a header' ],
+ ];
+ const wrapper = shallow( );
+
+ expect( wrapper.html() ).toBe( 'This is a header
' );
+ } );
+
+ it( 'should render value with deeply nested DOM nodes', () => {
+ const value = [
+ 'This is a ',
+ [ 'strong', {}, 'paragraph' ],
+ ' with a ',
+ [ 'a', { href: 'https://w.org/' }, 'link with ', [
+ 'b', {}, 'bold ', [
+ 'i', {}, 'and italics',
+ ],
+ ] ],
+ '.',
+ ];
+ const wrapper = shallow( );
+
+ expect( wrapper.html() ).toBe(
+ ''
+ );
+ } );
+ } );
} );
diff --git a/blocks/library/audio/index.js b/blocks/library/audio/index.js
index 19562063157f8..903ebe15ad388 100644
--- a/blocks/library/audio/index.js
+++ b/blocks/library/audio/index.js
@@ -177,7 +177,7 @@ registerBlockType( 'core/audio', {
return (
- { caption && caption.length > 0 && { caption } }
+ { caption && caption.length > 0 && }
);
},
diff --git a/blocks/library/button/index.js b/blocks/library/button/index.js
index 46fdf9c1b543d..b5b5d65f70a63 100644
--- a/blocks/library/button/index.js
+++ b/blocks/library/button/index.js
@@ -206,7 +206,7 @@ registerBlockType( 'core/button', {
return (
);
diff --git a/blocks/library/cover-image/index.js b/blocks/library/cover-image/index.js
index 7404a4cb5333c..fb2224afc571d 100644
--- a/blocks/library/cover-image/index.js
+++ b/blocks/library/cover-image/index.js
@@ -181,7 +181,7 @@ registerBlockType( 'core/cover-image', {
return (
);
},
diff --git a/blocks/library/embed/index.js b/blocks/library/embed/index.js
index 9b53cf9a11116..c5a03b3df6f33 100644
--- a/blocks/library/embed/index.js
+++ b/blocks/library/embed/index.js
@@ -234,7 +234,7 @@ function getEmbedBlockSettings( { title, icon, category = 'embed', transforms, k
return (
{ `\n${ url }\n` /* URL needs to be on its own line. */ }
- { caption && caption.length > 0 && { caption } }
+ { caption && caption.length > 0 && }
);
},
diff --git a/blocks/library/heading/index.js b/blocks/library/heading/index.js
index 9fbca6f3c4bda..e95a11e6e47ed 100644
--- a/blocks/library/heading/index.js
+++ b/blocks/library/heading/index.js
@@ -2,7 +2,6 @@
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
-import { concatChildren } from '@wordpress/element';
import { Toolbar } from '@wordpress/components';
/**
@@ -94,7 +93,7 @@ registerBlockType( 'core/heading', {
merge( attributes, attributesToMerge ) {
return {
- content: concatChildren( attributes.content, attributesToMerge.content ),
+ content: [ ...attributes.content, ...attributesToMerge.content ],
};
},
@@ -174,7 +173,7 @@ registerBlockType( 'core/heading', {
return (
- { content }
+
);
},
diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js
index 4c94d5f26de71..5c5534fc02a95 100644
--- a/blocks/library/image/index.js
+++ b/blocks/library/image/index.js
@@ -11,6 +11,7 @@ import './style.scss';
import './editor.scss';
import { registerBlockType, createBlock } from '../../api';
import ImageBlock from './block';
+import Editable from '../../editable';
registerBlockType( 'core/image', {
title: __( 'Image' ),
@@ -150,7 +151,7 @@ registerBlockType( 'core/image', {
return (
{ href ? { image } : image }
- { caption && caption.length > 0 && { caption } }
+ { caption && caption.length > 0 && }
);
},
diff --git a/blocks/library/list/index.js b/blocks/library/list/index.js
index b136253422fe1..c3a2834f41d98 100644
--- a/blocks/library/list/index.js
+++ b/blocks/library/list/index.js
@@ -361,11 +361,8 @@ registerBlockType( 'core/list', {
save( { attributes } ) {
const { nodeName, values } = attributes;
+ const Tag = nodeName.toLowerCase();
- return createElement(
- nodeName.toLowerCase(),
- null,
- values
- );
+ return ;
},
} );
diff --git a/blocks/library/paragraph/index.js b/blocks/library/paragraph/index.js
index 983661ce52446..dc29e8ad9854e 100644
--- a/blocks/library/paragraph/index.js
+++ b/blocks/library/paragraph/index.js
@@ -7,7 +7,7 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { concatChildren, Component } from '@wordpress/element';
+import { Component } from '@wordpress/element';
import { Autocomplete, PanelBody, PanelColor, withFallbackStyles } from '@wordpress/components';
/**
@@ -253,7 +253,7 @@ registerBlockType( 'core/paragraph', {
merge( attributes, attributesToMerge ) {
return {
- content: concatChildren( attributes.content, attributesToMerge.content ),
+ content: [ ...attributes.content, ...attributesToMerge.content ],
};
},
@@ -280,7 +280,11 @@ registerBlockType( 'core/paragraph', {
textAlign: align,
};
- return { content }
;
+ return (
+
+
+
+ );
},
} );
diff --git a/blocks/library/preformatted/index.js b/blocks/library/preformatted/index.js
index e5fe21e7a6d6e..b28085a8a9267 100644
--- a/blocks/library/preformatted/index.js
+++ b/blocks/library/preformatted/index.js
@@ -87,6 +87,6 @@ registerBlockType( 'core/preformatted', {
save( { attributes } ) {
const { content } = attributes;
- return { content }
;
+ return
;
},
} );
diff --git a/blocks/library/pullquote/index.js b/blocks/library/pullquote/index.js
index fc55e75ecf0ed..d8e8334c0fff0 100644
--- a/blocks/library/pullquote/index.js
+++ b/blocks/library/pullquote/index.js
@@ -120,11 +120,9 @@ registerBlockType( 'core/pullquote', {
return (
- { value && value.map( ( paragraph, i ) =>
- { paragraph.children && paragraph.children.props.children }
- ) }
+
{ citation && citation.length > 0 && (
- { citation }
+
) }
);
diff --git a/blocks/library/quote/index.js b/blocks/library/quote/index.js
index 3b7a6a1061849..197ea44792d64 100644
--- a/blocks/library/quote/index.js
+++ b/blocks/library/quote/index.js
@@ -227,11 +227,9 @@ registerBlockType( 'core/quote', {
className={ style === 2 ? 'is-large' : '' }
style={ { textAlign: align ? align : null } }
>
- { value.map( ( paragraph, i ) => (
- { paragraph.children && paragraph.children.props.children }
- ) ) }
+
{ citation && citation.length > 0 && (
- { citation }
+
) }
);
diff --git a/blocks/library/table/index.js b/blocks/library/table/index.js
index 861017d695fcf..70b62db1e745c 100644
--- a/blocks/library/table/index.js
+++ b/blocks/library/table/index.js
@@ -14,6 +14,7 @@ import BlockControls from '../../block-controls';
import BlockAlignmentToolbar from '../../block-alignment-toolbar';
import InspectorControls from '../../inspector-controls';
import BlockDescription from '../../block-description';
+import Editable from '../../editable';
registerBlockType( 'core/table', {
title: __( 'Table' ),
@@ -26,10 +27,29 @@ registerBlockType( 'core/table', {
source: 'children',
selector: 'table',
default: [
-
-
|
|
-
|
|
- ,
+ [
+ 'tbody', {}, [
+ 'tr', {}, [
+ 'td', {}, [
+ 'br', {},
+ ],
+ ], [
+ 'td', {}, [
+ 'br', {},
+ ],
+ ],
+ ], [
+ 'tr', {}, [
+ 'td', {}, [
+ 'br', {},
+ ],
+ ], [
+ 'td', {}, [
+ 'br', {},
+ ],
+ ],
+ ],
+ ],
],
},
align: {
@@ -89,7 +109,7 @@ registerBlockType( 'core/table', {
const { content, align } = attributes;
return (
);
},
diff --git a/blocks/library/text-columns/index.js b/blocks/library/text-columns/index.js
index a84684c9285e6..5c8b81e064125 100644
--- a/blocks/library/text-columns/index.js
+++ b/blocks/library/text-columns/index.js
@@ -114,7 +114,7 @@ registerBlockType( 'core/text-columns', {
{ times( columns, ( index ) =>
-
{ content && content[ index ].children }
+
{ content && content[ index ] && }
) }
diff --git a/blocks/library/verse/index.js b/blocks/library/verse/index.js
index 7c553121bacb0..61eb412463483 100644
--- a/blocks/library/verse/index.js
+++ b/blocks/library/verse/index.js
@@ -78,6 +78,6 @@ registerBlockType( 'core/verse', {
},
save( { attributes, className } ) {
- return { attributes.content }
;
+ return
;
},
} );
diff --git a/blocks/library/video/index.js b/blocks/library/video/index.js
index 427054dbbabb0..8a00be4b06c4e 100644
--- a/blocks/library/video/index.js
+++ b/blocks/library/video/index.js
@@ -142,10 +142,9 @@ registerBlockType( 'core/video', {
save( { attributes } ) {
const { src, caption, align } = attributes;
return (
-
{ src && }
- { caption && caption.length > 0 && { caption } }
+ { caption && caption.length > 0 && }
);
},
diff --git a/blocks/test/fixtures/core__heading__h2-em.json b/blocks/test/fixtures/core__heading__h2-em.json
index 39674931b4429..2f6af6a1afcf5 100644
--- a/blocks/test/fixtures/core__heading__h2-em.json
+++ b/blocks/test/fixtures/core__heading__h2-em.json
@@ -6,10 +6,11 @@
"attributes": {
"content": [
"The ",
- {
- "type": "em",
- "children": "Inserter"
- },
+ [
+ "em",
+ {},
+ "Inserter"
+ ],
" Tool"
],
"nodeName": "H2"
diff --git a/blocks/test/fixtures/core__list__ul.json b/blocks/test/fixtures/core__list__ul.json
index 15bc029cf8de1..9e03274c49e4a 100644
--- a/blocks/test/fixtures/core__list__ul.json
+++ b/blocks/test/fixtures/core__list__ul.json
@@ -6,37 +6,42 @@
"attributes": {
"nodeName": "UL",
"values": [
- {
- "type": "li",
- "children": "Text & Headings"
- },
- {
- "type": "li",
- "children": "Images & Videos"
- },
- {
- "type": "li",
- "children": "Galleries"
- },
- {
- "type": "li",
- "children": "Embeds, like YouTube, Tweets, or other WordPress posts."
- },
- {
- "type": "li",
- "children": "Layout blocks, like Buttons, Hero Images, Separators, etc."
- },
- {
- "type": "li",
- "children": [
- "And ",
- {
- "type": "em",
- "children": "Lists"
- },
- " like this one of course :)"
- ]
- }
+ [
+ "li",
+ {},
+ "Text & Headings"
+ ],
+ [
+ "li",
+ {},
+ "Images & Videos"
+ ],
+ [
+ "li",
+ {},
+ "Galleries"
+ ],
+ [
+ "li",
+ {},
+ "Embeds, like YouTube, Tweets, or other WordPress posts."
+ ],
+ [
+ "li",
+ {},
+ "Layout blocks, like Buttons, Hero Images, Separators, etc."
+ ],
+ [
+ "li",
+ {},
+ "And ",
+ [
+ "em",
+ {},
+ "Lists"
+ ],
+ " like this one of course :)"
+ ]
]
},
"originalContent": "- Text & Headings
- Images & Videos
- Galleries
- Embeds, like YouTube, Tweets, or other WordPress posts.
- Layout blocks, like Buttons, Hero Images, Separators, etc.
- And Lists like this one of course :)
"
diff --git a/blocks/test/fixtures/core__preformatted.json b/blocks/test/fixtures/core__preformatted.json
index 37ca66e8c95ad..a3bbb9daac74e 100644
--- a/blocks/test/fixtures/core__preformatted.json
+++ b/blocks/test/fixtures/core__preformatted.json
@@ -6,14 +6,16 @@
"attributes": {
"content": [
"Some ",
- {
- "type": "em",
- "children": "preformatted"
- },
+ [
+ "em",
+ {},
+ "preformatted"
+ ],
" text...",
- {
- "type": "br"
- },
+ [
+ "br",
+ {}
+ ],
"And more!"
]
},
diff --git a/blocks/test/fixtures/core__pullquote.json b/blocks/test/fixtures/core__pullquote.json
index 5ebe0b5564fb2..f0235d70916cf 100644
--- a/blocks/test/fixtures/core__pullquote.json
+++ b/blocks/test/fixtures/core__pullquote.json
@@ -5,18 +5,11 @@
"isValid": true,
"attributes": {
"value": [
- {
- "children": {
- "type": "p",
- "key": null,
- "ref": null,
- "props": {
- "children": "Testing pullquote block..."
- },
- "_owner": null,
- "_store": {}
- }
- }
+ [
+ "p",
+ {},
+ "Testing pullquote block..."
+ ]
],
"citation": [
"...with a caption"
diff --git a/blocks/test/fixtures/core__pullquote__multi-paragraph.json b/blocks/test/fixtures/core__pullquote__multi-paragraph.json
index 29eed74d38b3b..6e0e4e3d45e45 100644
--- a/blocks/test/fixtures/core__pullquote__multi-paragraph.json
+++ b/blocks/test/fixtures/core__pullquote__multi-paragraph.json
@@ -5,42 +5,21 @@
"isValid": true,
"attributes": {
"value": [
- {
- "children": {
- "type": "p",
- "key": null,
- "ref": null,
- "props": {
- "children": [
- "Paragraph ",
- {
- "type": "strong",
- "key": "_domReact68",
- "ref": null,
- "props": {
- "children": "one"
- },
- "_owner": null,
- "_store": {}
- }
- ]
- },
- "_owner": null,
- "_store": {}
- }
- },
- {
- "children": {
- "type": "p",
- "key": null,
- "ref": null,
- "props": {
- "children": "Paragraph two"
- },
- "_owner": null,
- "_store": {}
- }
- }
+ [
+ "p",
+ {},
+ "Paragraph ",
+ [
+ "strong",
+ {},
+ "one"
+ ]
+ ],
+ [
+ "p",
+ {},
+ "Paragraph two"
+ ]
],
"citation": [
"by whomever"
diff --git a/blocks/test/fixtures/core__quote__style-1.json b/blocks/test/fixtures/core__quote__style-1.json
index bea152f89f32c..7f048eb1c35fc 100644
--- a/blocks/test/fixtures/core__quote__style-1.json
+++ b/blocks/test/fixtures/core__quote__style-1.json
@@ -5,18 +5,11 @@
"isValid": true,
"attributes": {
"value": [
- {
- "children": {
- "type": "p",
- "key": null,
- "ref": null,
- "props": {
- "children": "The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery."
- },
- "_owner": null,
- "_store": {}
- }
- }
+ [
+ "p",
+ {},
+ "The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery."
+ ]
],
"citation": [
"Matt Mullenweg, 2017"
diff --git a/blocks/test/fixtures/core__quote__style-2.json b/blocks/test/fixtures/core__quote__style-2.json
index ea48f03aef42f..e5daf2ff8b519 100644
--- a/blocks/test/fixtures/core__quote__style-2.json
+++ b/blocks/test/fixtures/core__quote__style-2.json
@@ -5,18 +5,11 @@
"isValid": true,
"attributes": {
"value": [
- {
- "children": {
- "type": "p",
- "key": null,
- "ref": null,
- "props": {
- "children": "There is no greater agony than bearing an untold story inside you."
- },
- "_owner": null,
- "_store": {}
- }
- }
+ [
+ "p",
+ {},
+ "There is no greater agony than bearing an untold story inside you."
+ ]
],
"citation": [
"Maya Angelou"
diff --git a/blocks/test/fixtures/core__table.json b/blocks/test/fixtures/core__table.json
index 2ecdee94dd749..dfb3610bb2c99 100644
--- a/blocks/test/fixtures/core__table.json
+++ b/blocks/test/fixtures/core__table.json
@@ -5,195 +5,209 @@
"isValid": true,
"attributes": {
"content": [
- {
- "type": "thead",
- "children": {
- "type": "tr",
- "children": [
- {
- "type": "th",
- "children": "Version"
- },
- {
- "type": "th",
- "children": "Musician"
- },
- {
- "type": "th",
- "children": "Date"
- }
+ [
+ "thead",
+ {},
+ [
+ "tr",
+ {},
+ [
+ "th",
+ {},
+ "Version"
+ ],
+ [
+ "th",
+ {},
+ "Musician"
+ ],
+ [
+ "th",
+ {},
+ "Date"
]
- }
- },
- {
- "type": "tbody",
- "children": [
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": {
- "type": "a",
- "attributes": {
- "href": "https://wordpress.org/news/2003/05/wordpress-now-available/"
- },
- "children": ".70"
- }
- },
- {
- "type": "td",
- "children": "No musician chosen."
+ ]
+ ],
+ [
+ "tbody",
+ {},
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ [
+ "a",
+ {
+ "href": "https://wordpress.org/news/2003/05/wordpress-now-available/"
},
- {
- "type": "td",
- "children": "May 27, 2003"
- }
+ ".70"
]
- },
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": {
- "type": "a",
- "attributes": {
- "href": "https://wordpress.org/news/2004/01/wordpress-10/"
- },
- "children": "1.0"
- }
- },
- {
- "type": "td",
- "children": "Miles Davis"
+ ],
+ [
+ "td",
+ {},
+ "No musician chosen."
+ ],
+ [
+ "td",
+ {},
+ "May 27, 2003"
+ ]
+ ],
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ [
+ "a",
+ {
+ "href": "https://wordpress.org/news/2004/01/wordpress-10/"
},
- {
- "type": "td",
- "children": "January 3, 2004"
- }
+ "1.0"
]
- },
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": [
- "Lots of versions skipped, see ",
- {
- "type": "a",
- "attributes": {
- "href": "https://codex.wordpress.org/WordPress_Versions"
- },
- "children": "the full list"
- }
- ]
- },
- {
- "type": "td",
- "children": "…"
+ ],
+ [
+ "td",
+ {},
+ "Miles Davis"
+ ],
+ [
+ "td",
+ {},
+ "January 3, 2004"
+ ]
+ ],
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ "Lots of versions skipped, see ",
+ [
+ "a",
+ {
+ "href": "https://codex.wordpress.org/WordPress_Versions"
},
- {
- "type": "td",
- "children": "…"
- }
+ "the full list"
]
- },
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": {
- "type": "a",
- "attributes": {
- "href": "https://wordpress.org/news/2015/12/clifford/"
- },
- "children": "4.4"
- }
- },
- {
- "type": "td",
- "children": "Clifford Brown"
+ ],
+ [
+ "td",
+ {},
+ "…"
+ ],
+ [
+ "td",
+ {},
+ "…"
+ ]
+ ],
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ [
+ "a",
+ {
+ "href": "https://wordpress.org/news/2015/12/clifford/"
},
- {
- "type": "td",
- "children": "December 8, 2015"
- }
+ "4.4"
]
- },
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": {
- "type": "a",
- "attributes": {
- "href": "https://wordpress.org/news/2016/04/coleman/"
- },
- "children": "4.5"
- }
- },
- {
- "type": "td",
- "children": "Coleman Hawkins"
+ ],
+ [
+ "td",
+ {},
+ "Clifford Brown"
+ ],
+ [
+ "td",
+ {},
+ "December 8, 2015"
+ ]
+ ],
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ [
+ "a",
+ {
+ "href": "https://wordpress.org/news/2016/04/coleman/"
},
- {
- "type": "td",
- "children": "April 12, 2016"
- }
+ "4.5"
]
- },
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": {
- "type": "a",
- "attributes": {
- "href": "https://wordpress.org/news/2016/08/pepper/"
- },
- "children": "4.6"
- }
- },
- {
- "type": "td",
- "children": "Pepper Adams"
+ ],
+ [
+ "td",
+ {},
+ "Coleman Hawkins"
+ ],
+ [
+ "td",
+ {},
+ "April 12, 2016"
+ ]
+ ],
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ [
+ "a",
+ {
+ "href": "https://wordpress.org/news/2016/08/pepper/"
},
- {
- "type": "td",
- "children": "August 16, 2016"
- }
+ "4.6"
]
- },
- {
- "type": "tr",
- "children": [
- {
- "type": "td",
- "children": {
- "type": "a",
- "attributes": {
- "href": "https://wordpress.org/news/2016/12/vaughan/"
- },
- "children": "4.7"
- }
- },
- {
- "type": "td",
- "children": "Sarah Vaughan"
+ ],
+ [
+ "td",
+ {},
+ "Pepper Adams"
+ ],
+ [
+ "td",
+ {},
+ "August 16, 2016"
+ ]
+ ],
+ [
+ "tr",
+ {},
+ [
+ "td",
+ {},
+ [
+ "a",
+ {
+ "href": "https://wordpress.org/news/2016/12/vaughan/"
},
- {
- "type": "td",
- "children": "December 6, 2016"
- }
+ "4.7"
]
- }
+ ],
+ [
+ "td",
+ {},
+ "Sarah Vaughan"
+ ],
+ [
+ "td",
+ {},
+ "December 6, 2016"
+ ]
]
- }
+ ]
]
},
"originalContent": "Version | Musician | Date |
---|
.70 | No musician chosen. | May 27, 2003 |
1.0 | Miles Davis | January 3, 2004 |
Lots of versions skipped, see the full list | … | … |
4.4 | Clifford Brown | December 8, 2015 |
4.5 | Coleman Hawkins | April 12, 2016 |
4.6 | Pepper Adams | August 16, 2016 |
4.7 | Sarah Vaughan | December 6, 2016 |
"
diff --git a/blocks/test/fixtures/core__text__converts-to-paragraph.json b/blocks/test/fixtures/core__text__converts-to-paragraph.json
index 0efed063a93be..684fd2f9db6b3 100644
--- a/blocks/test/fixtures/core__text__converts-to-paragraph.json
+++ b/blocks/test/fixtures/core__text__converts-to-paragraph.json
@@ -6,10 +6,11 @@
"attributes": {
"content": [
"This is an old-style text block. Changed to ",
- {
- "type": "code",
- "children": "paragraph"
- },
+ [
+ "code",
+ {},
+ "paragraph"
+ ],
" in #2135."
],
"dropCap": false
diff --git a/blocks/test/fixtures/core__verse.json b/blocks/test/fixtures/core__verse.json
index 0baa254be043a..4633bbe53681b 100644
--- a/blocks/test/fixtures/core__verse.json
+++ b/blocks/test/fixtures/core__verse.json
@@ -6,14 +6,16 @@
"attributes": {
"content": [
"A ",
- {
- "type": "em",
- "children": "verse"
- },
+ [
+ "em",
+ {},
+ "verse"
+ ],
"…",
- {
- "type": "br"
- },
+ [
+ "br",
+ {}
+ ],
"And more!"
]
},
diff --git a/docs/blocks-controls.md b/docs/blocks-controls.md
index 50d96ce1e3029..fb1196e17f8a3 100644
--- a/docs/blocks-controls.md
+++ b/docs/blocks-controls.md
@@ -143,7 +143,7 @@ registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-04', {
save( { attributes, className } ) {
const { content } = attributes;
- return { content }
;
+ return
;
},
} );
```
diff --git a/docs/blocks-editable.md b/docs/blocks-editable.md
index 7a5a9ce3fa77e..334dedda56b56 100644
--- a/docs/blocks-editable.md
+++ b/docs/blocks-editable.md
@@ -99,7 +99,7 @@ registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-03', {
save( { attributes, className } ) {
const { content } = attributes;
- return { content }
;
+ return
;
},
} );
```
diff --git a/package-lock.json b/package-lock.json
index d73c5ce0e5323..d4cd9d97290ee 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2810,11 +2810,6 @@
"isarray": "1.0.0"
}
},
- "dom-react": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/dom-react/-/dom-react-2.2.0.tgz",
- "integrity": "sha1-3GJwYI7VbL35DJo+w1U/m1oL17M="
- },
"dom-scroll-into-view": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/dom-scroll-into-view/-/dom-scroll-into-view-1.2.1.tgz",
diff --git a/package.json b/package.json
index f136b915cc164..dfe2c609a3580 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,6 @@
"@wordpress/url": "0.1.0-beta.1",
"classnames": "2.2.5",
"clipboard": "1.7.1",
- "dom-react": "2.2.0",
"dom-scroll-into-view": "1.2.1",
"element-closest": "2.0.2",
"escape-string-regexp": "1.0.5",