Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichText: Use a simplified format for rich text values #7476

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions blocks/api/matchers.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* WordPress dependencies
*/
import { createElement } from '@wordpress/element';

/**
* External dependencies
*/
import { nodeListToReact, nodeToReact } from 'dom-react';
export { attr, prop, html, text, query } from 'hpq';

/**
* WordPress dependencies
*/
import { createSimpleElement } from '@wordpress/element';

export const children = ( selector ) => {
return ( domNode ) => {
let match = domNode;
Expand All @@ -18,7 +18,7 @@ export const children = ( selector ) => {
}

if ( match ) {
return nodeListToReact( match.childNodes || [], createElement );
return nodeListToReact( match.childNodes || [], createSimpleElement );
}

return [];
Expand All @@ -33,6 +33,6 @@ export const node = ( selector ) => {
match = domNode.querySelector( selector );
}

return nodeToReact( match, createElement );
return nodeToReact( match, createSimpleElement );
};
};
2 changes: 1 addition & 1 deletion blocks/api/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { every, keys, isEqual, isFunction, isString } from 'lodash';
import { every, keys, isEqual, isFunction, isString, omit } from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable.

import { default as tinycolor, mostReadable } from 'tinycolor2';

/**
Expand Down
2 changes: 1 addition & 1 deletion core-blocks/test/fixtures/core__heading__h2-em.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"The ",
{
"type": "em",
"children": "Inserter"
"children": [ "Inserter" ]
},
" Tool"
],
Expand Down
12 changes: 6 additions & 6 deletions core-blocks/test/fixtures/core__list__ul.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@
"values": [
{
"type": "li",
"children": "Text & Headings"
"children": [ "Text & Headings" ]
},
{
"type": "li",
"children": "Images & Videos"
"children": [ "Images & Videos" ]
},
{
"type": "li",
"children": "Galleries"
"children": [ "Galleries" ]
},
{
"type": "li",
"children": "Embeds, like YouTube, Tweets, or other WordPress posts."
"children": [ "Embeds, like YouTube, Tweets, or other WordPress posts." ]
},
{
"type": "li",
"children": "Layout blocks, like Buttons, Hero Images, Separators, etc."
"children": [ "Layout blocks, like Buttons, Hero Images, Separators, etc." ]
},
{
"type": "li",
"children": [
"And ",
{
"type": "em",
"children": "Lists"
"children": [ "Lists" ]
},
" like this one of course :)"
]
Expand Down
5 changes: 3 additions & 2 deletions core-blocks/test/fixtures/core__preformatted.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
"Some ",
{
"type": "em",
"children": "preformatted"
"children": [ "preformatted" ]
},
" text...",
{
"type": "br"
"type": "br",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny formatting? Running npm run fixtures:regenerates introduces a number of changes locally.

"children": []
},
"And more!"
]
Expand Down
8 changes: 2 additions & 6 deletions core-blocks/test/fixtures/core__pullquote.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
{
"children": {
"type": "p",
"key": null,
"ref": null,
"props": {
"children": "Testing pullquote block..."
},
"_owner": null,
"_store": {}
"children": [ "Testing pullquote block..." ]
}
}
}
],
Expand Down
22 changes: 5 additions & 17 deletions core-blocks/test/fixtures/core__pullquote__multi-paragraph.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,25 @@
{
"children": {
"type": "p",
"key": null,
"ref": null,
"props": {
"children": [
"Paragraph ",
{
"type": "strong",
"key": "_domReact71",
"ref": null,
"props": {
"children": "one"
},
"_owner": null,
"_store": {}
"children": [ "one" ]
}
}
]
},
"_owner": null,
"_store": {}
}
}
},
{
"children": {
"type": "p",
"key": null,
"ref": null,
"props": {
"children": "Paragraph two"
},
"_owner": null,
"_store": {}
"children": [ "Paragraph two" ]
}
}
}
],
Expand Down
8 changes: 2 additions & 6 deletions core-blocks/test/fixtures/core__quote__style-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
{
"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": {}
"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." ]
}
}
}
],
Expand Down
8 changes: 2 additions & 6 deletions core-blocks/test/fixtures/core__quote__style-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
{
"children": {
"type": "p",
"key": null,
"ref": null,
"props": {
"children": "There is no greater agony than bearing an untold story inside you."
},
"_owner": null,
"_store": {}
"children": [ "There is no greater agony than bearing an untold story inside you." ]
}
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion core-blocks/test/fixtures/core__subhead.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"This is a ",
{
"type": "em",
"children": "subhead"
"children": [ "subhead" ]
},
"."
]
Expand Down
Loading