Skip to content

Commit

Permalink
rich-text-value => rich-text, better deprecation messages, cast strin…
Browse files Browse the repository at this point in the history
…g to rich text value during block creation
  • Loading branch information
ellatrix committed Oct 1, 2018
1 parent b25545d commit 94352e7
Show file tree
Hide file tree
Showing 87 changed files with 194 additions and 125 deletions.
6 changes: 3 additions & 3 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@
"parent": "packages"
},
{
"title": "@wordpress/rich-text-value",
"slug": "packages-rich-text-value",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/rich-text-value/README.md",
"title": "@wordpress/rich-text",
"slug": "packages-rich-text",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/rich-text/README.md",
"parent": "packages"
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo

## 4.4.0

- The block attribute sources `children` and `node` have been removed. Please use the `rich-text-value` source instead. See the core blocks for examples.
- The block attribute sources `children` and `node` have been removed. Please use the `rich-text` source instead. See the core blocks for examples.
- `wp.blocks.node.matcher` has been removed. Please use `wp.richTextValue.create` instead.
- `wp.blocks.node.toHTML` has been removed. Please use `wp.richTextValue.toHTMLString` instead.
- `wp.blocks.node.fromDOM` has been removed. Please use `wp.richTextValue.create` instead.
Expand Down
14 changes: 7 additions & 7 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,10 @@ function gutenberg_register_scripts_and_styles() {
true
);
wp_register_script(
'wp-rich-text-value',
gutenberg_url( 'build/rich-text-value/index.js' ),
'wp-rich-text',
gutenberg_url( 'build/rich-text/index.js' ),
array( 'wp-polyfill', 'wp-escape-html', 'lodash' ),
filemtime( gutenberg_dir_path() . 'build/rich-text-value/index.js' ),
filemtime( gutenberg_dir_path() . 'build/rich-text/index.js' ),
true
);
wp_register_script(
Expand All @@ -397,7 +397,7 @@ function gutenberg_register_scripts_and_styles() {
'wp-keycodes',
'wp-polyfill',
'wp-url',
'wp-rich-text-value',
'wp-rich-text',
),
filemtime( gutenberg_dir_path() . 'build/components/index.js' ),
true
Expand All @@ -423,7 +423,7 @@ function gutenberg_register_scripts_and_styles() {
'wp-polyfill',
'wp-shortcode',
'lodash',
'wp-rich-text-value',
'wp-rich-text',
),
filemtime( gutenberg_dir_path() . 'build/blocks/index.js' ),
true
Expand Down Expand Up @@ -458,7 +458,7 @@ function gutenberg_register_scripts_and_styles() {
'wp-polyfill',
'wp-url',
'wp-viewport',
'wp-rich-text-value',
'wp-rich-text',
),
filemtime( gutenberg_dir_path() . 'build/block-library/index.js' ),
true
Expand Down Expand Up @@ -618,7 +618,7 @@ function gutenberg_register_scripts_and_styles() {
'wp-url',
'wp-viewport',
'wp-wordcount',
'wp-rich-text-value',
'wp-rich-text',
),
filemtime( gutenberg_dir_path() . 'build/editor/index.js' )
);
Expand Down
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@wordpress/nux": "file:packages/nux",
"@wordpress/plugins": "file:packages/plugins",
"@wordpress/redux-routine": "file:packages/redux-routine",
"@wordpress/rich-text-value": "file:packages/rich-text-value",
"@wordpress/rich-text": "file:packages/rich-text",
"@wordpress/shortcode": "file:packages/shortcode",
"@wordpress/token-list": "file:packages/token-list",
"@wordpress/url": "file:packages/url",
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/audio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export const settings = {
attribute: 'src',
},
caption: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'figcaption',
},
id: {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ const blockAttributes = {
attribute: 'title',
},
text: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'a',
},
backgroundColor: {
Expand Down
6 changes: 2 additions & 4 deletions packages/block-library/src/cover-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const validAlignments = [ 'left', 'center', 'right', 'wide', 'full' ];

const blockAttributes = {
title: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'p',
},
url: {
Expand Down Expand Up @@ -275,8 +274,7 @@ export const settings = {
attributes: {
...blockAttributes,
title: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'h2',
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ const embedAttributes = {
type: 'string',
},
caption: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'figcaption',
},
type: {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/gallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ const blockAttributes = {
attribute: 'data-id',
},
caption: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'figcaption',
},
},
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
getBlockType,
} from '@wordpress/blocks';
import { RichText } from '@wordpress/editor';
import { concat } from '@wordpress/rich-text-value';
import { concat } from '@wordpress/rich-text';

/**
* Internal dependencies
Expand All @@ -39,8 +39,7 @@ const supports = {

const schema = {
content: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'h1,h2,h3,h4,h5,h6',
},
level: {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const blockAttributes = {
default: '',
},
caption: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'figcaption',
},
href: {
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
BlockControls,
RichText,
} from '@wordpress/editor';
import { replace, join, split, isEmpty } from '@wordpress/rich-text-value';
import { replace, join, split, isEmpty } from '@wordpress/rich-text';

const listContentSchema = {
...getPhrasingContentSchema(),
Expand Down Expand Up @@ -47,8 +47,7 @@ const schema = {
default: false,
},
values: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'ol,ul',
multiline: 'li',
},
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/paragraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
RichText,
} from '@wordpress/editor';
import { getPhrasingContentSchema } from '@wordpress/blocks';
import { create, concat } from '@wordpress/rich-text-value';
import { create, concat } from '@wordpress/rich-text';

/**
* Internal dependencies
Expand All @@ -30,8 +30,7 @@ const supports = {

const schema = {
content: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'p',
},
align: {
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/preformatted/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { __ } from '@wordpress/i18n';
import { createBlock, getPhrasingContentSchema } from '@wordpress/blocks';
import { RichText } from '@wordpress/editor';
import { create, concat } from '@wordpress/rich-text-value';
import { create, concat } from '@wordpress/rich-text';

export const name = 'core/preformatted';

Expand All @@ -19,8 +19,7 @@ export const settings = {

attributes: {
content: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'pre',
},
},
Expand Down
9 changes: 3 additions & 6 deletions packages/block-library/src/pullquote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ import {

const blockAttributes = {
value: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'blockquote',
multiline: 'p',
},
citation: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'cite',
},
mainColor: {
Expand Down Expand Up @@ -134,8 +132,7 @@ export const settings = {
attributes: {
...blockAttributes,
citation: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'footer',
},
align: {
Expand Down
11 changes: 4 additions & 7 deletions packages/block-library/src/quote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ import {
AlignmentToolbar,
RichText,
} from '@wordpress/editor';
import { join, split, concat } from '@wordpress/rich-text-value';
import { join, split, concat } from '@wordpress/rich-text';

const blockAttributes = {
value: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'blockquote',
multiline: 'p',
},
citation: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'cite',
},
align: {
Expand Down Expand Up @@ -240,8 +238,7 @@ export const settings = {
attributes: {
...blockAttributes,
citation: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'footer',
},
style: {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/subhead/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export const settings = {

attributes: {
content: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'p',
},
align: {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ function getTableSectionAttributeSchema( section ) {
selector: 'td,th',
query: {
content: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
},
tag: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/table/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { times } from 'lodash';
/**
* WordPress dependencies
*/
import { create } from '@wordpress/rich-text-value';
import { create } from '@wordpress/rich-text';

/**
* Creates a table state.
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/table/test/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import deepFreeze from 'deep-freeze';
/**
* WordPress dependencies
*/
import { create } from '@wordpress/rich-text-value';
import { create } from '@wordpress/rich-text';

/**
* Internal dependencies
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/text-columns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
RichText,
} from '@wordpress/editor';
import deprecated from '@wordpress/deprecated';
import { create } from '@wordpress/rich-text-value';
import { create } from '@wordpress/rich-text';

export const name = 'core/text-columns';

Expand All @@ -42,8 +42,7 @@ export const settings = {
selector: 'p',
query: {
children: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
},
},
default: [
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/verse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
BlockControls,
AlignmentToolbar,
} from '@wordpress/editor';
import { concat } from '@wordpress/rich-text-value';
import { concat } from '@wordpress/rich-text';

export const name = 'core/verse';

Expand All @@ -26,8 +26,7 @@ export const settings = {

attributes: {
content: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'pre',
},
textAlign: {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export const settings = {
attribute: 'autoplay',
},
caption: {
source: 'rich-text-value',
type: 'rich-text-value',
source: 'rich-text',
selector: 'figcaption',
},
controls: {
Expand Down
Loading

0 comments on commit 94352e7

Please sign in to comment.