diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index deef0e0d7fbef..d13652597953d 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -1,16 +1,5 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility for two minor releases, when possible. The current deprecations are listed below and are grouped by _the version at which they will be removed completely_. If your plugin depends on these behaviors, you must update to the recommended alternative before the noted version. -## 4.4.0 - -- 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. -- `wp.blocks.children.toHTML` has been removed. Please use `wp.richTextValue.toHTMLString` instead. -- `wp.blocks.children.fromDOM` has been removed. Please use `wp.richTextValue.create` instead. -- `wp.blocks.children.concat` has been removed. Please use `wp.richTextValue.concat` instead. -- `wp.blocks.children.getChildrenArray` has been removed. Please use `wp.richTextValue.create` instead. - ## 4.2.0 - Writing resolvers as async generators has been removed. Use the controls plugin instead. diff --git a/lib/client-assets.php b/lib/client-assets.php index 71678b5de04db..1c0f1059ea9a1 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -423,7 +423,6 @@ function gutenberg_register_scripts_and_styles() { 'wp-polyfill', 'wp-shortcode', 'lodash', - 'wp-rich-text', ), filemtime( gutenberg_dir_path() . 'build/blocks/index.js' ), true diff --git a/packages/block-library/src/audio/index.js b/packages/block-library/src/audio/index.js index 3df0228df9f9e..948a25f55596c 100644 --- a/packages/block-library/src/audio/index.js +++ b/packages/block-library/src/audio/index.js @@ -30,7 +30,7 @@ export const settings = { attribute: 'src', }, caption: { - source: 'rich-text', + source: 'html', selector: 'figcaption', }, id: { diff --git a/packages/block-library/src/button/index.js b/packages/block-library/src/button/index.js index 6794b9b765c67..5f41823636930 100644 --- a/packages/block-library/src/button/index.js +++ b/packages/block-library/src/button/index.js @@ -32,7 +32,7 @@ const blockAttributes = { attribute: 'title', }, text: { - source: 'rich-text', + source: 'html', selector: 'a', }, backgroundColor: { diff --git a/packages/block-library/src/cover-image/index.js b/packages/block-library/src/cover-image/index.js index 6f745f7c78808..82e3ebdac1ae0 100644 --- a/packages/block-library/src/cover-image/index.js +++ b/packages/block-library/src/cover-image/index.js @@ -28,7 +28,7 @@ const validAlignments = [ 'left', 'center', 'right', 'wide', 'full' ]; const blockAttributes = { title: { - source: 'rich-text', + source: 'html', selector: 'p', }, url: { @@ -310,7 +310,7 @@ export const settings = { attributes: { ...blockAttributes, title: { - source: 'rich-text', + source: 'html', selector: 'h2', }, }, diff --git a/packages/block-library/src/embed/index.js b/packages/block-library/src/embed/index.js index 32efcbaaa281f..363a26707fa36 100644 --- a/packages/block-library/src/embed/index.js +++ b/packages/block-library/src/embed/index.js @@ -371,7 +371,7 @@ const embedAttributes = { type: 'string', }, caption: { - source: 'rich-text', + source: 'html', selector: 'figcaption', }, type: { diff --git a/packages/block-library/src/file/index.js b/packages/block-library/src/file/index.js index 78f4173520899..3b8ae9f78359b 100644 --- a/packages/block-library/src/file/index.js +++ b/packages/block-library/src/file/index.js @@ -11,7 +11,7 @@ import { createBlobURL } from '@wordpress/blob'; import { createBlock } from '@wordpress/blocks'; import { select } from '@wordpress/data'; import { RichText } from '@wordpress/editor'; -import { getTextContent, isEmpty } from '@wordpress/rich-text'; +import { create, getTextContent } from '@wordpress/rich-text'; /** * Internal dependencies @@ -39,7 +39,7 @@ export const settings = { type: 'string', }, fileName: { - source: 'rich-text', + source: 'html', selector: 'a:not([download])', }, // Differs to the href when the block is configured to link to the attachment page @@ -61,7 +61,7 @@ export const settings = { default: true, }, downloadButtonText: { - source: 'rich-text', + source: 'html', selector: 'a[download]', default: __( 'Download' ), }, @@ -203,7 +203,7 @@ export const settings = { return ( href &&
- { ! isEmpty( fileName ) && + { ! RichText.isEmpty( fileName ) && { const { content } = shortcode; - const html = content.replace( /\s*]*>\s/, '' ); - return create( { html } ); + return content.replace( /\s*]*>\s/, '' ); }, }, href: { diff --git a/packages/block-library/src/list/index.js b/packages/block-library/src/list/index.js index 9a65c32ff60a8..671a1df18b722 100644 --- a/packages/block-library/src/list/index.js +++ b/packages/block-library/src/list/index.js @@ -18,7 +18,7 @@ import { BlockControls, RichText, } from '@wordpress/editor'; -import { replace, join, split, isEmpty } from '@wordpress/rich-text'; +import { replace, join, split, create, toHTMLString } from '@wordpress/rich-text'; const listContentSchema = { ...getPhrasingContentSchema(), @@ -47,7 +47,7 @@ const schema = { default: false, }, values: { - source: 'rich-text', + source: 'html', selector: 'ol,ul', multiline: 'li', }, @@ -74,9 +74,9 @@ export const settings = { blocks: [ 'core/paragraph' ], transform: ( blockAttributes ) => { return createBlock( 'core/list', { - values: join( blockAttributes.map( ( { content } ) => - replace( content, /\n/g, '\u2028' ) - ), '\u2028' ), + values: toHTMLString( join( blockAttributes.map( ( { content } ) => + replace( create( { html: content } ), /\n/g, '\u2028' ) + ), '\u2028' ), 'li' ), } ); }, }, @@ -131,9 +131,12 @@ export const settings = { type: 'block', blocks: [ 'core/paragraph' ], transform: ( { values } ) => - split( values, '\u2028' ).map( ( content ) => - createBlock( 'core/paragraph', { content } ) - ), + split( create( { html: values, multilineTag: 'li' } ), '\u2028' ) + .map( ( piece ) => + createBlock( 'core/paragraph', { + content: toHTMLString( piece ), + } ) + ), }, { type: 'block', @@ -182,16 +185,15 @@ export const settings = { ], merge( attributes, attributesToMerge ) { - const { values, content } = attributesToMerge; - const valueToMerge = values || content; + const { values } = attributesToMerge; - if ( isEmpty( valueToMerge ) ) { + if ( ! values || values === '
  • ' ) { return attributes; } return { ...attributes, - values: join( [ attributes.values, valueToMerge ], '\u2028' ), + values: attributes.values + values, }; }, @@ -329,7 +331,7 @@ export const settings = { blocks.push( createBlock( 'core/paragraph' ) ); } - if ( ! RichText.isEmpty( after ) ) { + if ( after !== '
  • ' ) { blocks.push( createBlock( 'core/list', { ordered, values: after, diff --git a/packages/block-library/src/list/test/__snapshots__/index.js.snap b/packages/block-library/src/list/test/__snapshots__/index.js.snap index b276a84668f60..8287138cfeea7 100644 --- a/packages/block-library/src/list/test/__snapshots__/index.js.snap +++ b/packages/block-library/src/list/test/__snapshots__/index.js.snap @@ -18,9 +18,7 @@ exports[`core/list block edit matches snapshot 1`] = ` contenteditable="true" data-is-placeholder-visible="true" role="textbox" - > -
  • - + />
      diff --git a/packages/block-library/src/paragraph/edit.js b/packages/block-library/src/paragraph/edit.js index b9ecb242d80ec..6e77735fd016f 100644 --- a/packages/block-library/src/paragraph/edit.js +++ b/packages/block-library/src/paragraph/edit.js @@ -99,7 +99,7 @@ class ParagraphBlock extends Component { onReplace, } = this.props; - if ( after ) { + if ( after !== null ) { // Append "After" content as a new paragraph block to the end of // any other blocks being inserted after the current paragraph. blocks.push( createBlock( name, { content: after } ) ); @@ -110,7 +110,7 @@ class ParagraphBlock extends Component { } const { content } = attributes; - if ( ! before ) { + if ( before === null ) { // If before content is omitted, treat as intent to delete block. onReplace( [] ); } else if ( content !== before ) { diff --git a/packages/block-library/src/paragraph/index.js b/packages/block-library/src/paragraph/index.js index 73aaab67184d0..ed391fc984c92 100644 --- a/packages/block-library/src/paragraph/index.js +++ b/packages/block-library/src/paragraph/index.js @@ -17,7 +17,6 @@ import { RichText, } from '@wordpress/editor'; import { getPhrasingContentSchema } from '@wordpress/blocks'; -import { create, concat } from '@wordpress/rich-text'; /** * Internal dependencies @@ -30,8 +29,9 @@ const supports = { const schema = { content: { - source: 'rich-text', + source: 'html', selector: 'p', + default: '', }, align: { type: 'string', @@ -195,17 +195,14 @@ export const settings = { return { attributes.content }; }, migrate( attributes ) { - return { - ...attributes, - content: create( { html: attributes.content } ), - }; + return attributes; }, }, ], merge( attributes, attributesToMerge ) { return { - content: concat( attributes.content, attributesToMerge.content ), + content: attributes.content + attributesToMerge.content, }; }, diff --git a/packages/block-library/src/preformatted/index.js b/packages/block-library/src/preformatted/index.js index 376fdc722cfe1..7f8296796bfd6 100644 --- a/packages/block-library/src/preformatted/index.js +++ b/packages/block-library/src/preformatted/index.js @@ -4,7 +4,6 @@ import { __ } from '@wordpress/i18n'; import { createBlock, getPhrasingContentSchema } from '@wordpress/blocks'; import { RichText } from '@wordpress/editor'; -import { create, concat } from '@wordpress/rich-text'; export const name = 'core/preformatted'; @@ -19,7 +18,7 @@ export const settings = { attributes: { content: { - source: 'rich-text', + source: 'html', selector: 'pre', }, }, @@ -31,7 +30,7 @@ export const settings = { blocks: [ 'core/code', 'core/paragraph' ], transform: ( { content } ) => createBlock( 'core/preformatted', { - content: create( { text: content } ), + content, } ), }, { @@ -87,7 +86,7 @@ export const settings = { merge( attributes, attributesToMerge ) { return { - content: concat( attributes.content, attributesToMerge.content ), + content: attributes.content + attributesToMerge.content, }; }, }; diff --git a/packages/block-library/src/pullquote/index.js b/packages/block-library/src/pullquote/index.js index f001d16adf054..0854fd237a08a 100644 --- a/packages/block-library/src/pullquote/index.js +++ b/packages/block-library/src/pullquote/index.js @@ -25,12 +25,12 @@ import { const blockAttributes = { value: { - source: 'rich-text', + source: 'html', selector: 'blockquote', multiline: 'p', }, citation: { - source: 'rich-text', + source: 'html', selector: 'cite', }, mainColor: { @@ -132,7 +132,7 @@ export const settings = { attributes: { ...blockAttributes, citation: { - source: 'rich-text', + source: 'html', selector: 'footer', }, align: { diff --git a/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap b/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap index 5c19c96bee738..4a96bb5863af5 100644 --- a/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap +++ b/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap @@ -22,9 +22,7 @@ exports[`core/pullquote block edit matches snapshot 1`] = ` contenteditable="true" data-is-placeholder-visible="true" role="textbox" - > -

      -

  • + />
    diff --git a/packages/block-library/src/quote/index.js b/packages/block-library/src/quote/index.js index f50aa75edacff..8035ff82293b6 100644 --- a/packages/block-library/src/quote/index.js +++ b/packages/block-library/src/quote/index.js @@ -14,16 +14,16 @@ import { AlignmentToolbar, RichText, } from '@wordpress/editor'; -import { join, split, concat } from '@wordpress/rich-text'; +import { join, split, create, toHTMLString } from '@wordpress/rich-text'; const blockAttributes = { value: { - source: 'rich-text', + source: 'html', selector: 'blockquote', multiline: 'p', }, citation: { - source: 'rich-text', + source: 'html', selector: 'cite', }, align: { @@ -55,7 +55,9 @@ export const settings = { blocks: [ 'core/paragraph' ], transform: ( attributes ) => { return createBlock( 'core/quote', { - value: join( attributes.map( ( { content } ) => content ), '\u2028' ), + value: toHTMLString( join( attributes.map( ( { content } ) => + create( { html: content } ) + ), '\u2028' ), 'p' ), } ); }, }, @@ -96,9 +98,12 @@ export const settings = { type: 'block', blocks: [ 'core/paragraph' ], transform: ( { value } ) => - split( value, '\u2028' ).map( ( content ) => - createBlock( 'core/paragraph', { content } ) - ), + split( create( { html: value, multilineTag: 'p' } ), '\u2028' ) + .map( ( piece ) => + createBlock( 'core/paragraph', { + content: toHTMLString( piece ), + } ) + ), }, { type: 'block', @@ -107,22 +112,23 @@ export const settings = { // If there is no quote content, use the citation as the // content of the resulting heading. A nonexistent citation // will result in an empty heading. - if ( RichText.isEmpty( value ) ) { + if ( value === '

    ' ) { return createBlock( 'core/heading', { content: citation, } ); } - const values = split( value, '\u2028' ); + const pieces = split( create( { html: value, multilineTag: 'p' } ), '\u2028' ); + const quotePieces = pieces.slice( 1 ); return [ createBlock( 'core/heading', { - content: values[ 0 ], + content: toHTMLString( pieces[ 0 ] ), } ), createBlock( 'core/quote', { ...attrs, citation, - value: join( values.slice( 1 ), '\u2028' ), + value: toHTMLString( quotePieces.length ? join( pieces.slice( 1 ), '\u2028' ) : create(), 'p' ), } ), ]; }, @@ -194,8 +200,8 @@ export const settings = { merge( attributes, attributesToMerge ) { return { ...attributes, - value: join( [ attributes.value, attributesToMerge.value ], '\u2028' ), - citation: concat( attributes.citation, attributesToMerge.citation ), + value: attributes.value + attributesToMerge.value, + citation: attributes.citation + attributesToMerge.citation, }; }, @@ -238,7 +244,7 @@ export const settings = { attributes: { ...blockAttributes, citation: { - source: 'rich-text', + source: 'html', selector: 'footer', }, style: { diff --git a/packages/block-library/src/quote/test/__snapshots__/index.js.snap b/packages/block-library/src/quote/test/__snapshots__/index.js.snap index 6ee688b9c96e7..813b6d8417cb6 100644 --- a/packages/block-library/src/quote/test/__snapshots__/index.js.snap +++ b/packages/block-library/src/quote/test/__snapshots__/index.js.snap @@ -21,9 +21,7 @@ exports[`core/quote block edit matches snapshot 1`] = ` contenteditable="true" data-is-placeholder-visible="true" role="textbox" - > -

    -

    + />
    diff --git a/packages/block-library/src/subhead/index.js b/packages/block-library/src/subhead/index.js index 77c7c4324e2b2..2a9b6cec48d6d 100644 --- a/packages/block-library/src/subhead/index.js +++ b/packages/block-library/src/subhead/index.js @@ -30,7 +30,7 @@ export const settings = { attributes: { content: { - source: 'rich-text', + source: 'html', selector: 'p', }, align: { diff --git a/packages/block-library/src/table/index.js b/packages/block-library/src/table/index.js index 40dc0f260657f..f2435d6c6ba94 100644 --- a/packages/block-library/src/table/index.js +++ b/packages/block-library/src/table/index.js @@ -58,7 +58,7 @@ function getTableSectionAttributeSchema( section ) { selector: 'td,th', query: { content: { - source: 'rich-text', + source: 'html', }, tag: { type: 'string', diff --git a/packages/block-library/src/table/state.js b/packages/block-library/src/table/state.js index 1c00c2582db58..233d181650c2d 100644 --- a/packages/block-library/src/table/state.js +++ b/packages/block-library/src/table/state.js @@ -3,11 +3,6 @@ */ import { times } from 'lodash'; -/** - * WordPress dependencies - */ -import { create } from '@wordpress/rich-text'; - /** * Creates a table state. * @@ -23,7 +18,7 @@ export function createTable( { return { body: times( rowCount, () => ( { cells: times( columnCount, () => ( { - content: create(), + content: '', tag: 'td', } ) ), } ) ), @@ -89,7 +84,7 @@ export function insertRow( state, { ...state[ section ].slice( 0, rowIndex ), { cells: times( cellCount, () => ( { - content: create(), + content: '', tag: 'td', } ) ), }, @@ -134,7 +129,7 @@ export function insertColumn( state, { cells: [ ...row.cells.slice( 0, columnIndex ), { - content: create(), + content: '', tag: 'td', }, ...row.cells.slice( columnIndex ), diff --git a/packages/block-library/src/table/test/state.js b/packages/block-library/src/table/test/state.js index 9bd1326f0a55f..c684333283738 100644 --- a/packages/block-library/src/table/test/state.js +++ b/packages/block-library/src/table/test/state.js @@ -3,11 +3,6 @@ */ import deepFreeze from 'deep-freeze'; -/** - * WordPress dependencies - */ -import { create } from '@wordpress/rich-text'; - /** * Internal dependencies */ @@ -25,11 +20,11 @@ const table = deepFreeze( { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -37,11 +32,11 @@ const table = deepFreeze( { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -54,11 +49,11 @@ const tableWithContent = deepFreeze( { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -66,11 +61,11 @@ const tableWithContent = deepFreeze( { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create( { text: 'test' } ), + content: 'test', tag: 'td', }, ], @@ -92,7 +87,7 @@ describe( 'updateCellContent', () => { section: 'body', rowIndex: 1, columnIndex: 1, - content: create( { text: 'test' } ), + content: 'test', } ); expect( state ).toEqual( tableWithContent ); @@ -111,11 +106,11 @@ describe( 'insertRow', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -123,11 +118,11 @@ describe( 'insertRow', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create( { text: 'test' } ), + content: 'test', tag: 'td', }, ], @@ -135,11 +130,11 @@ describe( 'insertRow', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -163,15 +158,15 @@ describe( 'insertColumn', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -179,15 +174,15 @@ describe( 'insertColumn', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create( { text: 'test' } ), + content: 'test', tag: 'td', }, { - content: create(), + content: '', tag: 'td', }, ], @@ -211,11 +206,11 @@ describe( 'deleteRow', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, { - content: create( { text: 'test' } ), + content: 'test', tag: 'td', }, ], @@ -239,7 +234,7 @@ describe( 'deleteColumn', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, ], @@ -247,7 +242,7 @@ describe( 'deleteColumn', () => { { cells: [ { - content: create( { text: 'test' } ), + content: 'test', tag: 'td', }, ], @@ -264,7 +259,7 @@ describe( 'deleteColumn', () => { { cells: [ { - content: create(), + content: '', tag: 'td', }, ], @@ -272,7 +267,7 @@ describe( 'deleteColumn', () => { { cells: [ { - content: create( { text: 'test' } ), + content: 'test', tag: 'td', }, ], diff --git a/packages/block-library/src/text-columns/index.js b/packages/block-library/src/text-columns/index.js index 8747662cd3034..6029199d8c3b4 100644 --- a/packages/block-library/src/text-columns/index.js +++ b/packages/block-library/src/text-columns/index.js @@ -42,7 +42,7 @@ export const settings = { selector: 'p', query: { children: { - source: 'rich-text', + source: 'html', }, }, default: [ diff --git a/packages/block-library/src/verse/index.js b/packages/block-library/src/verse/index.js index e48217fd8c0f2..664154ae43630 100644 --- a/packages/block-library/src/verse/index.js +++ b/packages/block-library/src/verse/index.js @@ -9,7 +9,6 @@ import { BlockControls, AlignmentToolbar, } from '@wordpress/editor'; -import { concat } from '@wordpress/rich-text'; export const name = 'core/verse'; @@ -26,7 +25,7 @@ export const settings = { attributes: { content: { - source: 'rich-text', + source: 'html', selector: 'pre', }, textAlign: { @@ -98,7 +97,7 @@ export const settings = { merge( attributes, attributesToMerge ) { return { - content: concat( attributes.content, attributesToMerge.content ), + content: attributes.content + attributesToMerge.content, }; }, }; diff --git a/packages/block-library/src/video/index.js b/packages/block-library/src/video/index.js index 9a482826dce10..3320e88cd93bf 100644 --- a/packages/block-library/src/video/index.js +++ b/packages/block-library/src/video/index.js @@ -32,7 +32,7 @@ export const settings = { attribute: 'autoplay', }, caption: { - source: 'rich-text', + source: 'html', selector: 'figcaption', }, controls: { diff --git a/packages/blocks/src/api/children.js b/packages/blocks/src/api/children.js index 0974c52fb4e8e..c31064f5e22a9 100644 --- a/packages/blocks/src/api/children.js +++ b/packages/blocks/src/api/children.js @@ -6,7 +6,6 @@ import { castArray } from 'lodash'; /** * WordPress dependencies */ -import deprecated from '@wordpress/deprecated'; import { renderToString } from '@wordpress/element'; /** @@ -45,12 +44,6 @@ export function getSerializeCapableElement( children ) { * @return {Array} An array of individual block nodes. */ function getChildrenArray( children ) { - deprecated( 'children and node source', { - alternative: 'rich-text source', - plugin: 'Gutenberg', - version: '4.4', - } ); - // The fact that block children are compatible with the element serializer // is merely an implementation detail that currently serves to be true, but // should not be mistaken as being a guarantee on the external API. @@ -66,12 +59,6 @@ function getChildrenArray( children ) { * @return {WPBlockChildren} Concatenated block node. */ export function concat( ...blockNodes ) { - deprecated( 'wp.blocks.children.concat', { - alternative: 'wp.richText.concat', - plugin: 'Gutenberg', - version: '4.4', - } ); - const result = []; for ( let i = 0; i < blockNodes.length; i++ ) { const blockNode = castArray( blockNodes[ i ] ); @@ -102,12 +89,6 @@ export function concat( ...blockNodes ) { * @return {WPBlockChildren} Block children equivalent to DOM nodes. */ export function fromDOM( domNodes ) { - deprecated( 'wp.blocks.children.fromDom', { - alternative: 'wp.richText.create', - plugin: 'Gutenberg', - version: '4.4', - } ); - const result = []; for ( let i = 0; i < domNodes.length; i++ ) { try { @@ -128,12 +109,6 @@ export function fromDOM( domNodes ) { * @return {string} String HTML representation of block node. */ export function toHTML( children ) { - deprecated( 'wp.blocks.children.toHTML', { - alternative: 'wp.richText.toHTMLString', - plugin: 'Gutenberg', - version: '4.4', - } ); - const element = getSerializeCapableElement( children ); return renderToString( element ); @@ -148,12 +123,6 @@ export function toHTML( children ) { * @return {Function} hpq matcher. */ export function matcher( selector ) { - deprecated( 'wp.blocks.children.matcher', { - hint: 'Use the rich-text source.', - plugin: 'Gutenberg', - version: '4.4', - } ); - return ( domNode ) => { let match = domNode; diff --git a/packages/blocks/src/api/factory.js b/packages/blocks/src/api/factory.js index b515cab33323a..02b05dddd60be 100644 --- a/packages/blocks/src/api/factory.js +++ b/packages/blocks/src/api/factory.js @@ -20,8 +20,6 @@ import { * WordPress dependencies */ import { createHooks, applyFilters } from '@wordpress/hooks'; -import { create } from '@wordpress/rich-text'; -import deprecated from '@wordpress/deprecated'; /** * Internal dependencies @@ -52,22 +50,7 @@ export function createBlock( name, blockAttributes = {}, innerBlocks = [] ) { result[ key ] = schema.default; } - if ( schema.source === 'rich-text' ) { - // Ensure value passed is always a rich text value. - if ( typeof result[ key ] === 'string' ) { - result[ key ] = create( { text: result[ key ] } ); - } else if ( ! result[ key ] || ! result[ key ].text ) { - result[ key ] = create(); - } - } - if ( [ 'node', 'children' ].indexOf( schema.source ) !== -1 ) { - deprecated( `${ schema.source } source`, { - alternative: 'rich-text source', - plugin: 'Gutenberg', - version: '4.4', - } ); - // Ensure value passed is always an array, which we're expecting in // the RichText component to handle the deprecated value. if ( typeof result[ key ] === 'string' ) { diff --git a/packages/blocks/src/api/matchers.js b/packages/blocks/src/api/matchers.js index 604dfb6249e0f..7a6ac84891658 100644 --- a/packages/blocks/src/api/matchers.js +++ b/packages/blocks/src/api/matchers.js @@ -1,12 +1,7 @@ /** * External dependencies */ -export { attr, prop, html, text, query } from 'hpq'; - -/** - * WordPress dependencies - */ -import { create } from '@wordpress/rich-text'; +export { attr, prop, text, query } from 'hpq'; /** * Internal dependencies @@ -14,7 +9,7 @@ import { create } from '@wordpress/rich-text'; export { matcher as node } from './node'; export { matcher as children } from './children'; -export function richText( selector, multilineTag ) { +export function html( selector, multilineTag ) { return ( domNode ) => { let match = domNode; @@ -22,9 +17,27 @@ export function richText( selector, multilineTag ) { match = domNode.querySelector( selector ); } - return create( { - element: match, - multilineTag, - } ); + if ( ! match ) { + return ''; + } + + if ( multilineTag ) { + let value = ''; + const length = match.children.length; + + for ( let index = 0; index < length; index++ ) { + const child = match.children[ index ]; + + if ( child.nodeName.toLowerCase() !== multilineTag ) { + continue; + } + + value += child.outerHTML; + } + + return value; + } + + return match.innerHTML; }; } diff --git a/packages/blocks/src/api/node.js b/packages/blocks/src/api/node.js index 8be74944fb726..abcacf2b41c0c 100644 --- a/packages/blocks/src/api/node.js +++ b/packages/blocks/src/api/node.js @@ -1,8 +1,3 @@ -/** - * WordPress dependencies - */ -import deprecated from '@wordpress/deprecated'; - /** * Internal dependencies */ @@ -34,12 +29,6 @@ const { TEXT_NODE, ELEMENT_NODE } = window.Node; * @return {boolean} Whether node is of intended type. */ function isNodeOfType( node, type ) { - deprecated( 'wp.blocks.node.isNodeOfType', { - alternative: 'node.type', - plugin: 'Gutenberg', - version: '4.4', - } ); - return node && node.type === type; } @@ -74,12 +63,6 @@ export function getNamedNodeMapAsObject( nodeMap ) { * @return {WPBlockNode} Block node equivalent to DOM node. */ export function fromDOM( domNode ) { - deprecated( 'wp.blocks.node.fromDOM', { - alternative: 'wp.richText.create', - plugin: 'Gutenberg', - version: '4.4', - } ); - if ( domNode.nodeType === TEXT_NODE ) { return domNode.nodeValue; } @@ -108,12 +91,6 @@ export function fromDOM( domNode ) { * @return {string} String HTML representation of block node. */ export function toHTML( node ) { - deprecated( 'wp.blocks.node.toHTML', { - alternative: 'wp.richText.toHTMLString', - plugin: 'Gutenberg', - version: '4.4', - } ); - return children.toHTML( [ node ] ); } @@ -126,12 +103,6 @@ export function toHTML( node ) { * @return {Function} hpq matcher. */ export function matcher( selector ) { - deprecated( 'node source', { - alternative: 'rich-text source', - plugin: 'Gutenberg', - version: '4.4', - } ); - return ( domNode ) => { let match = domNode; diff --git a/packages/blocks/src/api/parser.js b/packages/blocks/src/api/parser.js index 9c80636e35647..d71fdbe0ac38e 100644 --- a/packages/blocks/src/api/parser.js +++ b/packages/blocks/src/api/parser.js @@ -19,7 +19,7 @@ import { getBlockType, getUnknownTypeHandlerName } from './registration'; import { createBlock } from './factory'; import { isValidBlock } from './validation'; import { getCommentDelimitedContent } from './serializer'; -import { attr, html, text, query, node, children, prop, richText } from './matchers'; +import { attr, html, text, query, node, children, prop } from './matchers'; /** * Sources which are guaranteed to return a string value. @@ -191,15 +191,13 @@ export function matcherFromSource( sourceConfig ) { return matcher; case 'html': - return html( sourceConfig.selector ); + return html( sourceConfig.selector, sourceConfig.multiline ); case 'text': return text( sourceConfig.selector ); case 'children': return children( sourceConfig.selector ); case 'node': return node( sourceConfig.selector ); - case 'rich-text': - return richText( sourceConfig.selector, sourceConfig.multiline ); case 'query': const subMatchers = mapValues( sourceConfig.query, matcherFromSource ); return query( sourceConfig.selector, subMatchers ); @@ -240,7 +238,7 @@ export function parseWithAttributeSchema( innerHTML, attributeSchema ) { * @return {*} Attribute value. */ export function getBlockAttribute( attributeKey, attributeSchema, innerHTML, commentAttributes ) { - let { type } = attributeSchema; + const { type } = attributeSchema; let value; switch ( attributeSchema.source ) { @@ -258,9 +256,6 @@ export function getBlockAttribute( attributeKey, attributeSchema, innerHTML, com case 'tag': value = parseWithAttributeSchema( innerHTML, attributeSchema ); break; - case 'rich-text': - type = 'object'; - value = parseWithAttributeSchema( innerHTML, attributeSchema ); } if ( value !== undefined ) { diff --git a/packages/blocks/src/api/templates.js b/packages/blocks/src/api/templates.js index 9e37742d2ecc4..d09be49453e70 100644 --- a/packages/blocks/src/api/templates.js +++ b/packages/blocks/src/api/templates.js @@ -1,12 +1,18 @@ /** * External dependencies */ -import { every, map } from 'lodash'; +import { every, map, get, mapValues, isArray } from 'lodash'; + +/** + * WordPress dependencies + */ +import { renderToString } from '@wordpress/element'; /** * Internal dependencies */ import { createBlock } from './factory'; +import { getBlockType } from './registration'; /** * Checks whether a list of blocks matches a template by comparing the block names. @@ -56,9 +62,44 @@ export function synchronizeBlocksWithTemplate( blocks = [], template ) { return { ...block, innerBlocks }; } + // To support old templates that were using the "children" format + // for the attributes using "html" strings now, we normalize the template attributes + // before creating the blocks. + + const blockType = getBlockType( name ); + const isHTMLAttribute = ( attributeDefinition ) => get( attributeDefinition, [ 'source' ] ) === 'html'; + const isQueryAttribute = ( attributeDefinition ) => get( attributeDefinition, [ 'source' ] ) === 'query'; + + const normalizeAttributes = ( schema, values ) => { + return mapValues( values, ( value, key ) => { + return normalizeAttribute( schema[ key ], value ); + } ); + }; + const normalizeAttribute = ( definition, value ) => { + if ( isHTMLAttribute( definition ) && isArray( value ) ) { + // Introduce a deprecated call at this point + // When we're confident that "children" format should be removed from the templates. + + return renderToString( value ); + } + + if ( isQueryAttribute( definition ) && value ) { + return value.map( ( subValues ) => { + return normalizeAttributes( definition.query, subValues ); + } ); + } + + return value; + }; + + const normalizedAttributes = normalizeAttributes( + get( blockType, [ 'attributes' ], {} ), + attributes + ); + return createBlock( name, - attributes, + normalizedAttributes, synchronizeBlocksWithTemplate( [], innerBlocksTemplate ) ); } ); diff --git a/packages/blocks/src/api/test/children.js b/packages/blocks/src/api/test/children.js index 0b997bb2ada90..cc3fe5d76d28a 100644 --- a/packages/blocks/src/api/test/children.js +++ b/packages/blocks/src/api/test/children.js @@ -55,7 +55,6 @@ describe( 'concat', () => { }, ); - expect( console ).toHaveWarned(); expect( result ).toEqual( [ { type: 'strong', @@ -112,7 +111,6 @@ describe( 'toHTML', () => { const html = toHTML( children ); - expect( console ).toHaveWarned(); expect( html ).toBe( 'This is a test!' ); } ); } ); @@ -124,7 +122,6 @@ describe( 'fromDOM', () => { const blockNode = fromDOM( node.childNodes ); - expect( console ).toHaveWarned(); expect( blockNode ).toEqual( [ 'This ', { diff --git a/packages/blocks/src/api/test/factory.js b/packages/blocks/src/api/test/factory.js index 6399f09493f39..b6f563bafa3a6 100644 --- a/packages/blocks/src/api/test/factory.js +++ b/packages/blocks/src/api/test/factory.js @@ -92,7 +92,6 @@ describe( 'block factory', () => { const block = createBlock( 'core/test-block' ); - expect( console ).toHaveWarned(); expect( block.attributes ).toEqual( { content: [], } ); @@ -141,7 +140,7 @@ describe( 'block factory', () => { ...defaultBlockSettings, attributes: { content: { - source: 'rich-text', + source: 'html', }, }, } ); @@ -151,10 +150,7 @@ describe( 'block factory', () => { } ); expect( block.attributes ).toEqual( { - content: { - formats: [ , , , , ], - text: 'test', - }, + content: 'test', } ); } ); } ); diff --git a/packages/blocks/src/api/test/matchers.js b/packages/blocks/src/api/test/matchers.js index 36ce2c07a1f34..32d1246a2e9d6 100644 --- a/packages/blocks/src/api/test/matchers.js +++ b/packages/blocks/src/api/test/matchers.js @@ -18,7 +18,6 @@ describe( 'matchers', () => { it( 'should return a source function', () => { const source = sources.children(); - expect( console ).toHaveWarned(); expect( typeof source ).toBe( 'function' ); } ); @@ -28,7 +27,6 @@ describe( 'matchers', () => { const html = '

    A delicious sundae dessert

    '; const match = parse( html, sources.children() ); - expect( console ).toHaveWarned(); expect( renderToString( match ) ).toBe( html ); } ); } ); @@ -37,7 +35,6 @@ describe( 'matchers', () => { it( 'should return a source function', () => { const source = sources.node(); - expect( console ).toHaveWarned(); expect( typeof source ).toBe( 'function' ); } ); diff --git a/packages/blocks/src/api/test/node.js b/packages/blocks/src/api/test/node.js index 6f78a5f96c518..447395a24ed12 100644 --- a/packages/blocks/src/api/test/node.js +++ b/packages/blocks/src/api/test/node.js @@ -31,7 +31,6 @@ describe( 'toHTML', () => { const html = toHTML( blockNode ); - expect( console ).toHaveWarned(); expect( html ).toBe( 'This is a test' ); } ); } ); @@ -42,7 +41,6 @@ describe( 'fromDOM', () => { const blockNode = fromDOM( node ); - expect( console ).toHaveWarned(); expect( blockNode ).toBe( 'Hello world' ); } ); @@ -59,7 +57,6 @@ describe( 'fromDOM', () => { const blockNode = fromDOM( node ); - expect( console ).toHaveWarned(); expect( blockNode ).toEqual( { type: 'strong', props: { diff --git a/packages/editor/src/components/block-list/test/block-html.js b/packages/editor/src/components/block-list/test/block-html.js index 7410aa74ba933..442e55de3f5bb 100644 --- a/packages/editor/src/components/block-list/test/block-html.js +++ b/packages/editor/src/components/block-list/test/block-html.js @@ -8,7 +8,6 @@ import { shallow } from 'enzyme'; */ import { createBlock } from '@wordpress/blocks'; import { registerCoreBlocks } from '@wordpress/block-library'; -import { create } from '@wordpress/rich-text'; /** * Internal dependencies @@ -35,7 +34,7 @@ describe( 'BlockHTML', () => { it( 'use block content for a valid block', () => { const block = createBlock( 'core/paragraph', { - content: create( { text: 'test-block' } ), + content: 'test-block', isValid: true, } ); diff --git a/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap b/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap index 7f799c687d240..a038d12930951 100644 --- a/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap +++ b/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap @@ -13,29 +13,9 @@ exports[`DocumentOutline header blocks present should match snapshot 1`] = ` path={Array []} > @@ -87,24 +48,9 @@ exports[`DocumentOutline header blocks present should render warnings for multip path={Array []} >

    { paragraph = createBlock( 'core/paragraph' ); headingH1 = createBlock( 'core/heading', { - content: create( { text: 'Heading 1' } ), + content: 'Heading 1', level: 1, } ); headingParent = createBlock( 'core/heading', { - content: create( { text: 'Heading parent' } ), + content: 'Heading parent', level: 2, } ); headingChild = createBlock( 'core/heading', { - content: create( { text: 'Heading child' } ), + content: 'Heading child', level: 3, } ); diff --git a/packages/editor/src/components/rich-text/index.js b/packages/editor/src/components/rich-text/index.js index e7bf658f683d7..e239b023f34f3 100644 --- a/packages/editor/src/components/rich-text/index.js +++ b/packages/editor/src/components/rich-text/index.js @@ -9,6 +9,7 @@ import { isNil, noop, isEqual, + omit, } from 'lodash'; import memize from 'memize'; @@ -784,12 +785,14 @@ export class RichText extends Component { const record = this.formatToValue( value ); if ( this.isActive() ) { - const length = getTextContent( prevProps.value ).length; + const prevRecord = this.formatToValue( prevProps.value ); + const length = getTextContent( prevRecord ).length; record.start = length; record.end = length; } this.applyRecord( record ); + this.savedContent = value; } } @@ -939,7 +942,8 @@ export class RichText extends Component { RichText.defaultProps = { formattingControls: FORMATTING_CONTROLS.map( ( { format } ) => format ), - format: 'rich-text', + format: 'string', + value: '', }; const RichTextContainer = compose( [ @@ -987,40 +991,39 @@ const RichTextContainer = compose( [ withSafeTimeout, ] )( RichText ); -RichTextContainer.Content = ( { value, format, tagName: Tag, multiline, ...props } ) => { +RichTextContainer.Content = ( { value, tagName: Tag, multiline: MultilineTag, ...props } ) => { let html = value; // Handle deprecated `children` and `node` sources. if ( Array.isArray( value ) ) { html = children.toHTML( value ); - } else if ( format !== 'string' ) { - html = toHTMLString( value, multiline ); + } + + if ( ! html && MultilineTag ) { + html = `<${ MultilineTag }>`; } const content = { html }; if ( Tag ) { - return { content }; + return { content }; } return content; }; -RichTextContainer.isEmpty = ( value ) => { +RichTextContainer.isEmpty = ( value = '' ) => { // Handle deprecated `children` and `node` sources. if ( Array.isArray( value ) ) { return ! value || value.length === 0; } - if ( typeof value === 'string' ) { - return value.length === 0; - } - - return isEmpty( value ); + return value.length === 0; }; RichTextContainer.Content.defaultProps = { - format: 'rich-text', + format: 'string', + value: '', }; export default RichTextContainer; diff --git a/packages/editor/src/components/rich-text/index.native.js b/packages/editor/src/components/rich-text/index.native.js index 617f5f0ea04b3..e2715369f7cdb 100644 --- a/packages/editor/src/components/rich-text/index.native.js +++ b/packages/editor/src/components/rich-text/index.native.js @@ -13,7 +13,6 @@ import { */ import { Component, RawHTML } from '@wordpress/element'; import { withInstanceId, compose } from '@wordpress/compose'; -import { toHTMLString } from '@wordpress/rich-text'; import { Toolbar } from '@wordpress/components'; /** @@ -179,7 +178,7 @@ export class RichText extends Component { } ) ); // Save back to HTML from React tree - const html = '<' + tagName + '>' + toHTMLString( value ) + ''; + const html = '<' + tagName + '>' + value + ''; return ( @@ -208,7 +207,7 @@ export class RichText extends Component { RichText.defaultProps = { formattingControls: FORMATTING_CONTROLS.map( ( { format } ) => format ), - format: 'children', + format: 'string', }; const RichTextContainer = compose( [ @@ -221,10 +220,6 @@ RichTextContainer.Content = ( { value, format, tagName: Tag, ...props } ) => { case 'string': content = { value }; break; - - case 'children': - content = { toHTMLString( value ) }; - break; } if ( Tag ) { @@ -237,7 +232,7 @@ RichTextContainer.Content = ( { value, format, tagName: Tag, ...props } ) => { RichTextContainer.isEmpty = isRichTextValueEmpty; RichTextContainer.Content.defaultProps = { - format: 'children', + format: 'string', }; export default RichTextContainer; diff --git a/test/e2e/specs/deprecated-node-matcher.test.js b/test/e2e/specs/deprecated-node-matcher.test.js index e9de62e3e207b..885ab8c9d4d6c 100644 --- a/test/e2e/specs/deprecated-node-matcher.test.js +++ b/test/e2e/specs/deprecated-node-matcher.test.js @@ -27,7 +27,6 @@ describe( 'Deprecated Node Matcher', () => { await insertBlock( 'Deprecated Node Matcher' ); await page.keyboard.type( 'test' ); await page.keyboard.press( 'Enter' ); - expect( console ).toHaveWarned(); expect( await getEditedPostContent() ).toMatchSnapshot(); } ); @@ -40,7 +39,6 @@ describe( 'Deprecated Node Matcher', () => { await page.keyboard.press( 'ArrowLeft' ); await page.keyboard.up( 'Shift' ); await pressWithModifier( META_KEY, 'b' ); - expect( console ).toHaveWarned(); expect( await getEditedPostContent() ).toMatchSnapshot(); } ); } ); diff --git a/test/e2e/specs/splitting-merging.test.js b/test/e2e/specs/splitting-merging.test.js index 7acee5bbe26e0..d059fbf42ea63 100644 --- a/test/e2e/specs/splitting-merging.test.js +++ b/test/e2e/specs/splitting-merging.test.js @@ -63,7 +63,7 @@ describe( 'splitting and merging blocks', () => { await page.keyboard.press( 'Backspace' ); // Replace contents of first paragraph with "Bar". - await pressTimes( 'Backspace', 3 ); + await pressTimes( 'Backspace', 4 ); await page.keyboard.type( 'Bar' ); expect( await getEditedPostContent() ).toMatchSnapshot(); diff --git a/test/e2e/test-plugins/block-icons.php b/test/e2e/test-plugins/block-icons.php index b07a1e903657e..0110f2cb68719 100644 --- a/test/e2e/test-plugins/block-icons.php +++ b/test/e2e/test-plugins/block-icons.php @@ -16,7 +16,6 @@ 'wp-editor', 'wp-hooks', 'wp-i18n', - 'wp-rich-text', ), filemtime( plugin_dir_path( __FILE__ ) . 'block-icons/index.js' ), true diff --git a/test/e2e/test-plugins/block-icons/index.js b/test/e2e/test-plugins/block-icons/index.js index 1c351147fda3f..705b03ebfbc91 100644 --- a/test/e2e/test-plugins/block-icons/index.js +++ b/test/e2e/test-plugins/block-icons/index.js @@ -1,6 +1,5 @@ ( function() { var registerBlockType = wp.blocks.registerBlockType; - var create = wp.richText.create; var el = wp.element.createElement; var InnerBlocks = wp.editor.InnerBlocks; var circle = el( 'circle', { cx: 10, cy: 10, r: 10, fill: 'red', stroke: 'blue', strokeWidth: '10' } ); @@ -19,7 +18,7 @@ allowedBlocks: [ 'core/paragraph', 'core/image' ], template: [ [ 'core/paragraph', { - content: create( { text: 'TestSimpleSvgIcon' } ), + content: 'TestSimpleSvgIcon', } ], ], } @@ -47,7 +46,7 @@ allowedBlocks: [ 'core/paragraph', 'core/image' ], template: [ [ 'core/paragraph', { - content: create( { text: 'TestDashIcon' } ), + content: 'TestDashIcon', } ], ], } @@ -77,7 +76,7 @@ allowedBlocks: [ 'core/paragraph', 'core/image' ], template: [ [ 'core/paragraph', { - content: create( { text: 'TestFunctionIcon' } ), + content: 'TestFunctionIcon', } ], ], } @@ -109,7 +108,7 @@ allowedBlocks: [ 'core/paragraph', 'core/image' ], template: [ [ 'core/paragraph', { - content: create( { text: 'TestIconColors' } ), + content: 'TestIconColors', } ], ], } @@ -140,7 +139,7 @@ allowedBlocks: [ 'core/paragraph', 'core/image' ], template: [ [ 'core/paragraph', { - content: create( { text: 'TestIconColors' } ), + content: 'TestIconColors', } ], ], } diff --git a/test/e2e/test-plugins/inner-blocks-templates/index.js b/test/e2e/test-plugins/inner-blocks-templates/index.js index d4ca5d70c521d..2c478968dea90 100644 --- a/test/e2e/test-plugins/inner-blocks-templates/index.js +++ b/test/e2e/test-plugins/inner-blocks-templates/index.js @@ -2,12 +2,11 @@ var registerBlockType = wp.blocks.registerBlockType; var el = wp.element.createElement; var InnerBlocks = wp.editor.InnerBlocks; - var create = wp.richText.create; var __ = wp.i18n.__; var TEMPLATE = [ [ 'core/paragraph', { fontSize: 'large', - content: create( { text: 'Content…' } ), + content: 'Content…', } ], ]; diff --git a/test/integration/fixtures/apple-out.html b/test/integration/fixtures/apple-out.html index 7c9e3a5b59fed..530bf8d34140c 100644 --- a/test/integration/fixtures/apple-out.html +++ b/test/integration/fixtures/apple-out.html @@ -19,7 +19,25 @@ -
    OneTwoThree
    123
    IIIIII
    +
    +One + +Two + +Three +
    +1 + +2 + +3 +
    +I + +II + +III +
    diff --git a/test/integration/fixtures/evernote-out.html b/test/integration/fixtures/evernote-out.html index 27c8dc98ffc11..4d8c6c43b9c99 100644 --- a/test/integration/fixtures/evernote-out.html +++ b/test/integration/fixtures/evernote-out.html @@ -1,5 +1,7 @@ -

    This is a paragraph.
    This is a
    link.

    +

    This is a paragraph. +
    This is a link. +

    @@ -15,7 +17,13 @@ -
    OneTwoThree
    FourFiveSix
    +
    One +Two +Three +
    Four +Five +Six +
    diff --git a/test/integration/fixtures/google-docs-out.html b/test/integration/fixtures/google-docs-out.html index a8d31000403d6..541a75306b02c 100644 --- a/test/integration/fixtures/google-docs-out.html +++ b/test/integration/fixtures/google-docs-out.html @@ -33,4 +33,3 @@

    This is a heading

    - diff --git a/test/integration/fixtures/markdown-out.html b/test/integration/fixtures/markdown-out.html index 62a402c79f001..cf83cf40050c4 100644 --- a/test/integration/fixtures/markdown-out.html +++ b/test/integration/fixtures/markdown-out.html @@ -7,7 +7,8 @@

    This is a heading with italic

    -

    Preserve
    line breaks please.

    +

    Preserve
    +line breaks please.

    diff --git a/test/integration/fixtures/ms-word-online-out.html b/test/integration/fixtures/ms-word-online-out.html index b61d20c6eb9c8..3088b7480877f 100644 --- a/test/integration/fixtures/ms-word-online-out.html +++ b/test/integration/fixtures/ms-word-online-out.html @@ -1,25 +1,25 @@ -

    This is a heading 

    +

    This is a heading 

    -

    This is a paragraph with a link

    +

    This is a paragraph with a link

    - + -
    1. One 
    2. Two 
    3. Three 
    +
    1. One 
    2. Two 
    3. Three 
    -
    One Two Three 
    II III 
    +
    One Two Three 
    II III 
    -

    An image: 

    +

    An image: 

    diff --git a/test/integration/fixtures/ms-word-out.html b/test/integration/fixtures/ms-word-out.html index edf7209a4f8f3..c53c5aaeba2e9 100644 --- a/test/integration/fixtures/ms-word-out.html +++ b/test/integration/fixtures/ms-word-out.html @@ -1,9 +1,11 @@ -

    This is atitle

    +

    This is a +title

    -

    This is asubtitle

    +

    This is a +subtitle

    @@ -27,7 +29,25 @@

    This is a heading level 2

    -
    One Two Three
    1 2 3
    I II III
    +
    + One + + Two + + Three +
    + 1 + + 2 + + 3 +
    + I + + II + + III +
    diff --git a/test/integration/fixtures/ms-word-styled-out.html b/test/integration/fixtures/ms-word-styled-out.html index a35ee97a42163..2eef7365f9668 100644 --- a/test/integration/fixtures/ms-word-styled-out.html +++ b/test/integration/fixtures/ms-word-styled-out.html @@ -1,7 +1,15 @@ -

    Loremipsum dolor sit amet, consectetur adipiscing elit 

    +

    +Lorem +ipsum dolor sit amet, consectetur adipiscing elit  +

    -

    Loremipsum dolor sit amet, consectetur adipiscing elit. Pellentesquealiquet hendrerit auctor. Nam lobortis, est vel lacinia tincidunt,purus tellus vehicula ex, nec pharetra justo dui sed lorem. Namcongue laoreet massa, quis varius est tincidunt ut.

    +

    +Lorem +ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque +aliquet hendrerit auctor. Nam lobortis, est vel lacinia tincidunt, +purus tellus vehicula ex, nec pharetra justo dui sed lorem. Nam +congue laoreet massa, quis varius est tincidunt ut.

    diff --git a/test/integration/full-content/fixtures/core__audio.json b/test/integration/full-content/fixtures/core__audio.json index 879f5f8371c9a..f9acbfdd8ce2d 100644 --- a/test/integration/full-content/fixtures/core__audio.json +++ b/test/integration/full-content/fixtures/core__audio.json @@ -5,10 +5,7 @@ "isValid": true, "attributes": { "src": "https://media.simplecast.com/episodes/audio/80564/draft-podcast-51-livePublish2.mp3", - "caption": { - "formats": [], - "text": "" - }, + "caption": "", "autoplay": false, "loop": false, "align": "right" diff --git a/test/integration/full-content/fixtures/core__button__center.json b/test/integration/full-content/fixtures/core__button__center.json index 4ccdc68fc2090..7334b3f483293 100644 --- a/test/integration/full-content/fixtures/core__button__center.json +++ b/test/integration/full-content/fixtures/core__button__center.json @@ -5,31 +5,7 @@ "isValid": true, "attributes": { "url": "https://github.com/WordPress/gutenberg", - "text": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Help build Gutenberg" - }, + "text": "Help build Gutenberg", "align": "center" }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__column.json b/test/integration/full-content/fixtures/core__column.json index 358a0d4e94a75..aabfc10300c5e 100644 --- a/test/integration/full-content/fixtures/core__column.json +++ b/test/integration/full-content/fixtures/core__column.json @@ -10,36 +10,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Column One, Paragraph One" - }, + "content": "Column One, Paragraph One", "dropCap": false }, "innerBlocks": [], @@ -50,36 +21,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Column One, Paragraph Two" - }, + "content": "Column One, Paragraph Two", "dropCap": false }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__columns.json b/test/integration/full-content/fixtures/core__columns.json index bbadafd319fb8..2a446b72dc79d 100644 --- a/test/integration/full-content/fixtures/core__columns.json +++ b/test/integration/full-content/fixtures/core__columns.json @@ -18,36 +18,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Column One, Paragraph One" - }, + "content": "Column One, Paragraph One", "dropCap": false }, "innerBlocks": [], @@ -58,36 +29,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Column One, Paragraph Two" - }, + "content": "Column One, Paragraph Two", "dropCap": false }, "innerBlocks": [], @@ -107,36 +49,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Column Two, Paragraph One" - }, + "content": "Column Two, Paragraph One", "dropCap": false }, "innerBlocks": [], @@ -147,38 +60,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Column Three, Paragraph One" - }, + "content": "Column Three, Paragraph One", "dropCap": false }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__cover-image.json b/test/integration/full-content/fixtures/core__cover-image.json index 1dfe4234cc147..342a160d3e4de 100644 --- a/test/integration/full-content/fixtures/core__cover-image.json +++ b/test/integration/full-content/fixtures/core__cover-image.json @@ -4,22 +4,7 @@ "name": "core/cover-image", "isValid": true, "attributes": { - "title": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Guten Berg!" - }, + "title": "Guten Berg!", "url": "https://cldup.com/uuUqE_dXzy.jpg", "contentAlign": "center", "hasParallax": false, diff --git a/test/integration/full-content/fixtures/core__embed.json b/test/integration/full-content/fixtures/core__embed.json index 11575f599e331..916935db4c4c3 100644 --- a/test/integration/full-content/fixtures/core__embed.json +++ b/test/integration/full-content/fixtures/core__embed.json @@ -5,47 +5,7 @@ "isValid": true, "attributes": { "url": "https://example.com/", - "caption": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Embedded content from an example URL" - }, + "caption": "Embedded content from an example URL", "allowResponsive": true }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__file__new-window.json b/test/integration/full-content/fixtures/core__file__new-window.json index 8882cfdaf9d7b..4922f02880ecc 100644 --- a/test/integration/full-content/fixtures/core__file__new-window.json +++ b/test/integration/full-content/fixtures/core__file__new-window.json @@ -6,31 +6,11 @@ "attributes": { "id": 176, "href": "http://localhost:8888/wp-content/uploads/2018/05/keycodes.js", - "fileName": { - "formats": [ - null, - null, - null, - null - ], - "text": "6546" - }, + "fileName": "6546", "textLinkHref": "http://localhost:8888/wp-content/uploads/2018/05/keycodes.js", "textLinkTarget": "_blank", "showDownloadButton": true, - "downloadButtonText": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Download" - } + "downloadButtonText": "Download" }, "innerBlocks": [], "originalContent": "
    6546Download
    " diff --git a/test/integration/full-content/fixtures/core__file__no-download-button.json b/test/integration/full-content/fixtures/core__file__no-download-button.json index f2ba1e521615e..44ff5553acbe1 100644 --- a/test/integration/full-content/fixtures/core__file__no-download-button.json +++ b/test/integration/full-content/fixtures/core__file__no-download-button.json @@ -6,26 +6,10 @@ "attributes": { "id": 176, "href": "http://localhost:8888/wp-content/uploads/2018/05/keycodes.js", - "fileName": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "lkjfijwef" - }, + "fileName": "lkjfijwef", "textLinkHref": "http://localhost:8888/?attachment_id=176", "showDownloadButton": false, - "downloadButtonText": { - "formats": [], - "text": "" - } + "downloadButtonText": "" }, "innerBlocks": [], "originalContent": "
    lkjfijwef
    " diff --git a/test/integration/full-content/fixtures/core__file__no-text-link.json b/test/integration/full-content/fixtures/core__file__no-text-link.json index 6a3ac7afc6078..6cf32d1f9d959 100644 --- a/test/integration/full-content/fixtures/core__file__no-text-link.json +++ b/test/integration/full-content/fixtures/core__file__no-text-link.json @@ -6,24 +6,9 @@ "attributes": { "id": 176, "href": "http://localhost:8888/wp-content/uploads/2018/05/keycodes.js", - "fileName": { - "formats": [], - "text": "" - }, + "fileName": "", "showDownloadButton": true, - "downloadButtonText": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Download" - } + "downloadButtonText": "Download" }, "innerBlocks": [], "originalContent": "
    Download
    " diff --git a/test/integration/full-content/fixtures/core__gallery.json b/test/integration/full-content/fixtures/core__gallery.json index 2dcebc80a03af..8cfcc26d3b37a 100644 --- a/test/integration/full-content/fixtures/core__gallery.json +++ b/test/integration/full-content/fixtures/core__gallery.json @@ -8,18 +8,12 @@ { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "title", - "caption": { - "formats": [], - "text": "" - } + "caption": "" }, { "url": "http://google.com/hi.png", "alt": "title", - "caption": { - "formats": [], - "text": "" - } + "caption": "" } ], "imageCrop": true, diff --git a/test/integration/full-content/fixtures/core__gallery__columns.json b/test/integration/full-content/fixtures/core__gallery__columns.json index a9d27c457cb01..b3daaa05f6e8a 100644 --- a/test/integration/full-content/fixtures/core__gallery__columns.json +++ b/test/integration/full-content/fixtures/core__gallery__columns.json @@ -8,18 +8,12 @@ { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "title", - "caption": { - "formats": [], - "text": "" - } + "caption": "" }, { "url": "http://google.com/hi.png", "alt": "title", - "caption": { - "formats": [], - "text": "" - } + "caption": "" } ], "columns": 1, diff --git a/test/integration/full-content/fixtures/core__heading__h2-em.json b/test/integration/full-content/fixtures/core__heading__h2-em.json index 786643107f39e..b72785dd6d8c2 100644 --- a/test/integration/full-content/fixtures/core__heading__h2-em.json +++ b/test/integration/full-content/fixtures/core__heading__h2-em.json @@ -4,60 +4,7 @@ "name": "core/heading", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - null, - null, - null, - null, - null - ], - "text": "The Inserter Tool" - }, + "content": "The Inserter Tool", "level": 2 }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__heading__h2.json b/test/integration/full-content/fixtures/core__heading__h2.json index 388f98214362d..f2073ff78bd43 100644 --- a/test/integration/full-content/fixtures/core__heading__h2.json +++ b/test/integration/full-content/fixtures/core__heading__h2.json @@ -4,69 +4,7 @@ "name": "core/heading", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "A picture is worth a thousand words, or so the saying goes" - }, + "content": "A picture is worth a thousand words, or so the saying goes", "level": 2 }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__image.json b/test/integration/full-content/fixtures/core__image.json index dd89c78069c8e..4369150f0c929 100644 --- a/test/integration/full-content/fixtures/core__image.json +++ b/test/integration/full-content/fixtures/core__image.json @@ -6,10 +6,7 @@ "attributes": { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "", - "caption": { - "formats": [], - "text": "" - }, + "caption": "", "linkDestination": "none" }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__image__attachment-link.json b/test/integration/full-content/fixtures/core__image__attachment-link.json index 3aaa94408659a..5d169589043a5 100644 --- a/test/integration/full-content/fixtures/core__image__attachment-link.json +++ b/test/integration/full-content/fixtures/core__image__attachment-link.json @@ -6,10 +6,7 @@ "attributes": { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "", - "caption": { - "formats": [], - "text": "" - }, + "caption": "", "href": "http://localhost:8888/?attachment_id=7", "linkDestination": "attachment" }, diff --git a/test/integration/full-content/fixtures/core__image__center-caption.json b/test/integration/full-content/fixtures/core__image__center-caption.json index 571e6ad5a676f..f569bda22c81b 100644 --- a/test/integration/full-content/fixtures/core__image__center-caption.json +++ b/test/integration/full-content/fixtures/core__image__center-caption.json @@ -6,78 +6,7 @@ "attributes": { "url": "https://cldup.com/YLYhpou2oq.jpg", "alt": "", - "caption": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Give it a try. Press the \"really wide\" button on the image toolbar." - }, + "caption": "Give it a try. Press the \"really wide\" button on the image toolbar.", "align": "center", "linkDestination": "none" }, diff --git a/test/integration/full-content/fixtures/core__image__custom-link.json b/test/integration/full-content/fixtures/core__image__custom-link.json index 136ae7357e680..735e552282662 100644 --- a/test/integration/full-content/fixtures/core__image__custom-link.json +++ b/test/integration/full-content/fixtures/core__image__custom-link.json @@ -6,10 +6,7 @@ "attributes": { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "", - "caption": { - "formats": [], - "text": "" - }, + "caption": "", "href": "https://wordpress.org/", "linkDestination": "custom" }, diff --git a/test/integration/full-content/fixtures/core__image__media-link.json b/test/integration/full-content/fixtures/core__image__media-link.json index 6b329e94a4837..690fa778b6fd5 100644 --- a/test/integration/full-content/fixtures/core__image__media-link.json +++ b/test/integration/full-content/fixtures/core__image__media-link.json @@ -6,10 +6,7 @@ "attributes": { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "", - "caption": { - "formats": [], - "text": "" - }, + "caption": "", "href": "https://cldup.com/uuUqE_dXzy.jpg", "linkDestination": "media" }, diff --git a/test/integration/full-content/fixtures/core__list__ul.json b/test/integration/full-content/fixtures/core__list__ul.json index 56fecc822876c..17baec7cef1c7 100644 --- a/test/integration/full-content/fixtures/core__list__ul.json +++ b/test/integration/full-content/fixtures/core__list__ul.json @@ -5,224 +5,7 @@ "isValid": true, "attributes": { "ordered": false, - "values": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "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 :)" - } + "values": "
  • 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 :)
  • " }, "innerBlocks": [], "originalContent": "" diff --git a/test/integration/full-content/fixtures/core__paragraph__align-right.json b/test/integration/full-content/fixtures/core__paragraph__align-right.json index cc4e7274557bd..079d9a704f2e9 100644 --- a/test/integration/full-content/fixtures/core__paragraph__align-right.json +++ b/test/integration/full-content/fixtures/core__paragraph__align-right.json @@ -4,81 +4,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "... like this one, which is separate from the above and right aligned." - }, + "content": "... like this one, which is separate from the above and right aligned.", "align": "right", "dropCap": false }, diff --git a/test/integration/full-content/fixtures/core__paragraph__deprecated.json b/test/integration/full-content/fixtures/core__paragraph__deprecated.json index daf5da7008a22..ce0f468e35188 100644 --- a/test/integration/full-content/fixtures/core__paragraph__deprecated.json +++ b/test/integration/full-content/fixtures/core__paragraph__deprecated.json @@ -4,56 +4,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - null, - null, - null, - null, - null, - null, - null - ], - "text": "Unwrapped is still valid." - }, + "content": "Unwrapped is still valid.", "dropCap": false }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__preformatted.json b/test/integration/full-content/fixtures/core__preformatted.json index 5c7db59e09b97..290c7e9849496 100644 --- a/test/integration/full-content/fixtures/core__preformatted.json +++ b/test/integration/full-content/fixtures/core__preformatted.json @@ -4,94 +4,7 @@ "name": "core/preformatted", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Some preformatted text...\nAnd more!" - } + "content": "Some preformatted text...
    And more!" }, "innerBlocks": [], "originalContent": "
    Some preformatted text...
    And more!
    " diff --git a/test/integration/full-content/fixtures/core__pullquote.json b/test/integration/full-content/fixtures/core__pullquote.json index 89cbf3529f896..5cf126489bc64 100644 --- a/test/integration/full-content/fixtures/core__pullquote.json +++ b/test/integration/full-content/fixtures/core__pullquote.json @@ -4,59 +4,8 @@ "name": "core/pullquote", "isValid": true, "attributes": { - "value": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Testing pullquote block..." - }, - "citation": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "...with a caption" - } + "value": "

    Testing pullquote block...

    ", + "citation": "...with a caption" }, "innerBlocks": [], "originalContent": "
    \n
    \n

    Testing pullquote block...

    ...with a caption\n
    \n
    " diff --git a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json index d2f54ac170e1b..81c058e5ab10c 100644 --- a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json +++ b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json @@ -4,66 +4,8 @@ "name": "core/pullquote", "isValid": true, "attributes": { - "value": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - [ - { - "type": "strong" - } - ], - [ - { - "type": "strong" - } - ], - [ - { - "type": "strong" - } - ], - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Paragraph one
Paragraph two" - }, - "citation": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "by whomever" - } + "value": "

    Paragraph one

    Paragraph two

    ", + "citation": "by whomever" }, "innerBlocks": [], "originalContent": "
    \n
    \n

    Paragraph one

    \n

    Paragraph two

    \n by whomever\n\t
    \n
    " diff --git a/test/integration/full-content/fixtures/core__quote__style-1.json b/test/integration/full-content/fixtures/core__quote__style-1.json index cddef91c40054..cd8d15bcc9b34 100644 --- a/test/integration/full-content/fixtures/core__quote__style-1.json +++ b/test/integration/full-content/fixtures/core__quote__style-1.json @@ -4,268 +4,8 @@ "name": "core/quote", "isValid": true, "attributes": { - "value": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "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": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Matt Mullenweg, 2017" - } + "value": "

    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" }, "innerBlocks": [], "originalContent": "

    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.

    Matt Mullenweg, 2017
    " diff --git a/test/integration/full-content/fixtures/core__quote__style-2.json b/test/integration/full-content/fixtures/core__quote__style-2.json index 29ed76be417ea..300770c72c007 100644 --- a/test/integration/full-content/fixtures/core__quote__style-2.json +++ b/test/integration/full-content/fixtures/core__quote__style-2.json @@ -4,94 +4,8 @@ "name": "core/quote", "isValid": true, "attributes": { - "value": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "There is no greater agony than bearing an untold story inside you." - }, - "citation": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Maya Angelou" - }, + "value": "

    There is no greater agony than bearing an untold story inside you.

    ", + "citation": "Maya Angelou", "className": "is-style-large" }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__subhead.json b/test/integration/full-content/fixtures/core__subhead.json index 291374ad1a6c1..a0c58740e2bc6 100644 --- a/test/integration/full-content/fixtures/core__subhead.json +++ b/test/integration/full-content/fixtures/core__subhead.json @@ -4,57 +4,7 @@ "name": "core/subhead", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - null - ], - "text": "This is a subhead." - } + "content": "This is a subhead." }, "innerBlocks": [], "originalContent": "

    This is a subhead.

    " diff --git a/test/integration/full-content/fixtures/core__table.json b/test/integration/full-content/fixtures/core__table.json index bdd286d4eaa09..7d71d09c53be8 100644 --- a/test/integration/full-content/fixtures/core__table.json +++ b/test/integration/full-content/fixtures/core__table.json @@ -9,46 +9,15 @@ { "cells": [ { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null - ], - "text": "Version" - }, + "content": "Version", "tag": "th" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Musician" - }, + "content": "Musician", "tag": "th" }, { - "content": { - "formats": [ - null, - null, - null, - null - ], - "text": "Date" - }, + "content": "Date", "tag": "th" } ] @@ -58,82 +27,15 @@ { "cells": [ { - "content": { - "formats": [ - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2003/05/wordpress-now-available/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2003/05/wordpress-now-available/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2003/05/wordpress-now-available/" - } - } - ] - ], - "text": ".70" - }, + "content": ".70", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "No musician chosen." - }, + "content": "No musician chosen.", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "May 27, 2003" - }, + "content": "May 27, 2003", "tag": "td" } ] @@ -141,77 +43,15 @@ { "cells": [ { - "content": { - "formats": [ - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2004/01/wordpress-10/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2004/01/wordpress-10/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2004/01/wordpress-10/" - } - } - ] - ], - "text": "1.0" - }, + "content": "1.0", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Miles Davis" - }, + "content": "Miles Davis", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "January 3, 2004" - }, + "content": "January 3, 2004", "tag": "td" } ] @@ -219,163 +59,15 @@ { "cells": [ { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://codex.wordpress.org/WordPress_Versions" - } - } - ] - ], - "text": "Lots of versions skipped, see the full list" - }, + "content": "Lots of versions skipped, see the full list", "tag": "td" }, { - "content": { - "formats": [ - null - ], - "text": "…" - }, + "content": "…", "tag": "td" }, { - "content": { - "formats": [ - null - ], - "text": "…" - }, + "content": "…", "tag": "td" } ] @@ -383,81 +75,15 @@ { "cells": [ { - "content": { - "formats": [ - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2015/12/clifford/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2015/12/clifford/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2015/12/clifford/" - } - } - ] - ], - "text": "4.4" - }, + "content": "4.4", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Clifford Brown" - }, + "content": "Clifford Brown", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "December 8, 2015" - }, + "content": "December 8, 2015", "tag": "td" } ] @@ -465,80 +91,15 @@ { "cells": [ { - "content": { - "formats": [ - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/04/coleman/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/04/coleman/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/04/coleman/" - } - } - ] - ], - "text": "4.5" - }, + "content": "4.5", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Coleman Hawkins" - }, + "content": "Coleman Hawkins", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "April 12, 2016" - }, + "content": "April 12, 2016", "tag": "td" } ] @@ -546,78 +107,15 @@ { "cells": [ { - "content": { - "formats": [ - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/08/pepper/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/08/pepper/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/08/pepper/" - } - } - ] - ], - "text": "4.6" - }, + "content": "4.6", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Pepper Adams" - }, + "content": "Pepper Adams", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "August 16, 2016" - }, + "content": "August 16, 2016", "tag": "td" } ] @@ -625,80 +123,15 @@ { "cells": [ { - "content": { - "formats": [ - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/12/vaughan/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/12/vaughan/" - } - } - ], - [ - { - "type": "a", - "attributes": { - "href": "https://wordpress.org/news/2016/12/vaughan/" - } - } - ] - ], - "text": "4.7" - }, + "content": "4.7", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "Sarah Vaughan" - }, + "content": "Sarah Vaughan", "tag": "td" }, { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "December 6, 2016" - }, + "content": "December 6, 2016", "tag": "td" } ] diff --git a/test/integration/full-content/fixtures/core__text-columns.json b/test/integration/full-content/fixtures/core__text-columns.json index 2a31ae6ff865f..f610db9e556a7 100644 --- a/test/integration/full-content/fixtures/core__text-columns.json +++ b/test/integration/full-content/fixtures/core__text-columns.json @@ -6,24 +6,10 @@ "attributes": { "content": [ { - "children": { - "formats": [ - null, - null, - null - ], - "text": "One" - } + "children": "One" }, { - "children": { - "formats": [ - null, - null, - null - ], - "text": "Two" - } + "children": "Two" } ], "columns": 2, diff --git a/test/integration/full-content/fixtures/core__text__converts-to-paragraph.json b/test/integration/full-content/fixtures/core__text__converts-to-paragraph.json index 951cc3900f3c1..2f85e75d9af26 100644 --- a/test/integration/full-content/fixtures/core__text__converts-to-paragraph.json +++ b/test/integration/full-content/fixtures/core__text__converts-to-paragraph.json @@ -4,111 +4,7 @@ "name": "core/paragraph", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - [ - { - "type": "code" - } - ], - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "This is an old-style text block. Changed to paragraph in #2135." - }, + "content": "This is an old-style text block. Changed to paragraph in #2135.", "dropCap": false }, "innerBlocks": [], diff --git a/test/integration/full-content/fixtures/core__verse.json b/test/integration/full-content/fixtures/core__verse.json index e7d92ea856bff..5c6e3d83e6516 100644 --- a/test/integration/full-content/fixtures/core__verse.json +++ b/test/integration/full-content/fixtures/core__verse.json @@ -4,49 +4,7 @@ "name": "core/verse", "isValid": true, "attributes": { - "content": { - "formats": [ - null, - null, - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - [ - { - "type": "em" - } - ], - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "text": "A verse…\nAnd more!" - } + "content": "A verse
    And more!" }, "innerBlocks": [], "originalContent": "
    A verse
    And more!
    " diff --git a/test/integration/full-content/fixtures/core__video.json b/test/integration/full-content/fixtures/core__video.json index b0a67a574890a..e91fd20c5bd8b 100644 --- a/test/integration/full-content/fixtures/core__video.json +++ b/test/integration/full-content/fixtures/core__video.json @@ -5,10 +5,7 @@ "isValid": true, "attributes": { "autoplay": false, - "caption": { - "formats": [], - "text": "" - }, + "caption": "", "controls": true, "loop": false, "muted": false,