diff --git a/.gitignore b/.gitignore
index 283066ff44c040..9d58efe7906a66 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ gutenberg.pot
yarn.lock
gutenberg.zip
storybook-static
+.DS_Store
diff --git a/.storybook/config.js b/.storybook/config.js
index b8cdf2a2bee922..35d9b93b2b2988 100644
--- a/.storybook/config.js
+++ b/.storybook/config.js
@@ -17,6 +17,7 @@ function loadStories() {
require( './stories/intro' );
require( './stories/contributing' );
require( './stories/coding-guidelines' );
+ require( './stories/design' );
require( '../i18n/story' );
require( '../element/story' );
require( '../blocks/story' );
diff --git a/.storybook/stories/design.js b/.storybook/stories/design.js
new file mode 100644
index 00000000000000..c2224d84af8c36
--- /dev/null
+++ b/.storybook/stories/design.js
@@ -0,0 +1,15 @@
+/**
+ * External dependencies
+ */
+import ReactMarkdown from 'react-markdown';
+import { storiesOf } from '@storybook/react';
+import { withKnobs } from '@storybook/addon-knobs';
+
+/**
+ * Internal dependencies
+ */
+import readme from '../../docs/design.md';
+
+storiesOf( 'Gutenberg', module )
+ .addDecorator( withKnobs )
+ .add( 'Design', () =>
'; const match = parse( html, query.children() ); - expect( wp.element.renderToString( match ) ).to.equal( html ); + expect( renderToString( match ) ).to.equal( html ); + } ); + } ); + + describe( 'node()', () => { + it( 'should return a matcher function', () => { + const matcher = query.node(); + + expect( matcher ).to.be.a( 'function' ); + } ); + + it( 'should return HTML equivalent WPElement of matched element', () => { + // Assumption here is that we can cleanly convert back and forth + // between a string and WPElement representation + const html = 'A delicious sundae dessert
'; + const match = parse( html, query.node() ); + + expect( wp.element.renderToString( match ) ).to.equal( `${ html }` ); } ); } ); } ); diff --git a/blocks/api/test/serializer.js b/blocks/api/test/serializer.js index ace404fbffdc97..85c3598f9a3117 100644 --- a/blocks/api/test/serializer.js +++ b/blocks/api/test/serializer.js @@ -3,10 +3,15 @@ */ import { expect } from 'chai'; +/** + * WordPress dependencies + */ +import { createElement, Component } from 'element'; + /** * Internal dependencies */ -import serialize, { getCommentAttributes, getSaveContent, serializeValue } from '../serializer'; +import serialize, { getCommentAttributes, getSaveContent, serializeAttributes } from '../serializer'; import { getBlockTypes, registerBlockType, unregisterBlockType } from '../registration'; describe( 'block serializer', () => { @@ -20,7 +25,10 @@ describe( 'block serializer', () => { context( 'function save', () => { it( 'should return string verbatim', () => { const saved = getSaveContent( - ( { attributes } ) => attributes.fruit, + { + save: ( { attributes } ) => attributes.fruit, + name: 'core/fruit', + }, { fruit: 'Bananas' } ); @@ -28,9 +36,49 @@ describe( 'block serializer', () => { } ); it( 'should return element as string if save returns element', () => { - const { createElement } = wp.element; const saved = getSaveContent( - ( { attributes } ) => createElement( 'div', null, attributes.fruit ), + { + save: ( { attributes } ) => createElement( 'div', null, attributes.fruit ), + name: 'core/fruit', + }, + { fruit: 'Bananas' } + ); + + expect( saved ).to.equal( 'A delicious sundae dessert
Ribs & Chicken
\n'; + const expectedPostContent = '\nRibs & Chicken
\n'; expect( serialize( blockList ) ).to.eql( expectedPostContent ); } ); diff --git a/blocks/block-description/index.js b/blocks/block-description/index.js new file mode 100644 index 00000000000000..cdf5749bff607d --- /dev/null +++ b/blocks/block-description/index.js @@ -0,0 +1,12 @@ +/** + * Internal dependencies + */ +import './style.scss'; + +export default function BlockDescription( { children } ) { + return ( + element with some content', () => {
+ const blockDescription = shallow( Hello World
{ placeholder }
} +{ __( 'Cover Image is a bold image block with an optional title.' ) }
+{ wp.i18n.__( 'Embedding…' ) }
+{ __( 'Embedding…' ) }
{ wp.i18n.__( 'Previews for this are unavailable in the editor, sorry!' ) }
+{ __( 'Previews for this are unavailable in the editor, sorry!' ) }
{ __( 'Image galleries are a great way to share groups of pictures on your site.' ) }
+{ __( 'Search engines use the headings to index the structure and content of your web pages.' ) }
+{ __( 'Size' ) }
+{ __( 'Text Alignment' ) }
+{ __( 'Worth a thousand words.' ) }
++ edit( { attributes, setAttributes, focus, setFocus, className } ) { + const { value, citation, align } = attributes; + const updateAlignment = ( nextAlign ) => setAttributes( { align: nextAlign } ); + + return [ + focus && ( +, + ]; }, save( { attributes } ) { - const { value, citation } = attributes; + const { value, citation, align = 'none' } = attributes; return ( -+ + ), ++ - ); +setAttributes( { value: nextValue, } ) } + placeholder={ __( 'Write quote…' ) } focus={ focus && focus.editable === 'value' ? focus : null } onFocus={ ( props ) => setFocus( { ...props, editable: 'value' } ) } + className="blocks-pullquote__content" /> { ( citation || !! focus ) && ( setAttributes( { citation: nextCitation, @@ -49,15 +77,15 @@ registerBlockType( 'core/pullquote', { inline /> ) } -
+{ value && value.map( ( paragraph, i ) => ({ paragraph }
) ) } diff --git a/blocks/library/pullquote/style.scss b/blocks/library/pullquote/style.scss index 476b0d38fe7561..2ba88b1c90c4a5 100644 --- a/blocks/library/pullquote/style.scss +++ b/blocks/library/pullquote/style.scss @@ -1,23 +1,18 @@ -.blocks-pullquote { - color: $light-gray-900; - padding: 2em; - text-align: center; - - footer { - color: $dark-gray-900; - position: relative; - } - - footer p { +.wp-block-pullquote { + footer .blocks-editable__tinymce[data-is-empty="true"]:before { font-size: 16px; font-family: $default-font; } -} -.editor-visual-editor .blocks-pullquote { + .blocks-editable__tinymce[data-is-empty="true"]:before { + width: 100%; + left: 50%; + transform: translateX( -50% ); + } + + & > .blocks-pullquote__content .blocks-editable__tinymce[data-is-empty="true"]:before, & > .blocks-editable p { - font-family: $default-font; font-size: 48px; - font-weight: 900; + font-weight: bold; } } diff --git a/blocks/library/quote/block.scss b/blocks/library/quote/block.scss new file mode 100644 index 00000000000000..03ff30255511c3 --- /dev/null +++ b/blocks/library/quote/block.scss @@ -0,0 +1,34 @@ +.wp-block-quote { + margin: 0; + box-shadow: inset 0px 0px 0px 0px $light-gray-500; + + footer { + color: $dark-gray-100; + margin-left: 1.3em; + margin-top: 1em; + position: relative; + font-size: $default-font-size; + font-style: normal; + + &:before { + content: '— '; + position: absolute; + left: -1.3em; + top: 0; + } + } + + + &.blocks-quote-style-1 { + border-left: 4px solid $black; + padding-left: 1em; + } + + &.blocks-quote-style-2 { + padding: 0 1em; + & > p { + font-size: 24px; + font-style: italic; + } + } +} diff --git a/blocks/library/quote/index.js b/blocks/library/quote/index.js index dc2a9508b2e7b4..16b71a20fddec6 100644 --- a/blocks/library/quote/index.js +++ b/blocks/library/quote/index.js @@ -1,38 +1,38 @@ +/** + * External dependencies + */ +import { isString, isObject } from 'lodash'; + /** * WordPress dependencies */ -import { switchChildrenNodeName } from 'element'; +import { __, sprintf } from 'i18n'; +import { Toolbar } from 'components'; /** * Internal dependencies */ -import './style.scss'; +import './block.scss'; import { registerBlockType, createBlock, query as hpq } from '../../api'; import AlignmentToolbar from '../../alignment-toolbar'; import BlockControls from '../../block-controls'; import Editable from '../../editable'; -const { children, query } = hpq; +const { children, node, query } = hpq; registerBlockType( 'core/quote', { - title: wp.i18n.__( 'Quote' ), + title: __( 'Quote' ), icon: 'format-quote', category: 'common', attributes: { - value: query( 'blockquote > p', children() ), + value: query( 'blockquote > p', node() ), citation: children( 'footer' ), }, - controls: [ 1, 2 ].map( ( variation ) => ( { - icon: 'format-quote', - title: wp.i18n.sprintf( wp.i18n.__( 'Quote style %d' ), variation ), - isActive: ( { style = 1 } ) => Number( style ) === variation, - onClick( attributes, setAttributes ) { - setAttributes( { style: variation } ); - }, - subscript: variation, - } ) ), + defaultAttributes: { + value: [], + }, transforms: { from: [ @@ -45,15 +45,6 @@ registerBlockType( 'core/quote', { } ); }, }, - { - type: 'block', - blocks: [ 'core/list' ], - transform: ( { values } ) => { - return createBlock( 'core/quote', { - value: switchChildrenNodeName( values, 'p' ), - } ); - }, - }, { type: 'block', blocks: [ 'core/heading' ], @@ -68,23 +59,28 @@ registerBlockType( 'core/quote', { { type: 'block', blocks: [ 'core/text' ], - transform: ( { value, citation } ) => { + transform: ( { value, citation, ...attrs } ) => { + const textElement = value[ 0 ]; + if ( ! textElement ) { + return createBlock( 'core/text', { + content: citation, + } ); + } + const textContent = isString( textElement ) ? textElement : textElement.props.children; + if ( Array.isArray( value ) || citation ) { + const text = createBlock( 'core/text', { + content: textContent, + } ); + const quote = createBlock( 'core/quote', { + ...attrs, + citation, + value: Array.isArray( value ) ? value.slice( 1 ) : '', + } ); + + return [ text, quote ]; + } return createBlock( 'core/text', { - content: wp.element.concatChildren( value, citation ), - } ); - }, - }, - { - type: 'block', - blocks: [ 'core/list' ], - transform: ( { value, citation } ) => { - const valueElements = switchChildrenNodeName( value, 'li' ); - const values = citation - ? wp.element.concatChildren( valueElements,{ citation } ) - : valueElements; - return createBlock( 'core/list', { - nodeName: 'ul', - values, + content: textContent, } ); }, }, @@ -92,9 +88,14 @@ registerBlockType( 'core/quote', { type: 'block', blocks: [ 'core/heading' ], transform: ( { value, citation, ...attrs } ) => { - if ( Array.isArray( value ) || citation ) { + const isMultiParagraph = Array.isArray( value ) && isObject( value[ 0 ] ) && value[ 0 ].type === 'p'; + const headingElement = isMultiParagraph ? value[ 0 ] : value; + const headingContent = isObject( headingElement ) && value[ 0 ].type === 'p' + ? headingElement.props.children + : headingElement; + if ( isMultiParagraph || citation ) { const heading = createBlock( 'core/heading', { - content: Array.isArray( value ) ? value[ 0 ] : value, + content: headingContent, } ); const quote = createBlock( 'core/quote', { ...attrs, @@ -105,20 +106,29 @@ registerBlockType( 'core/quote', { return [ heading, quote ]; } return createBlock( 'core/heading', { - content: value, + content: headingContent, } ); }, }, ], }, - edit( { attributes, setAttributes, focus, setFocus, mergeBlocks } ) { + edit( { attributes, setAttributes, focus, setFocus, mergeBlocks, className } ) { const { align, value, citation, style = 1 } = attributes; const focusedEditable = focus ? focus.editable || 'value' : null; return [ focus && (+ ), -( { + icon: 'format-quote', + title: sprintf( __( 'Quote style %d' ), variation ), + isActive: Number( style ) === variation, + onClick() { + setAttributes( { style: variation } ); + }, + subscript: variation, + } ) ) } /> { @@ -129,7 +139,7 @@ registerBlockType( 'core/quote', { ), setFocus( { ...props, editable: 'value' } ) } onMerge={ mergeBlocks } style={ { textAlign: align } } + placeholder={ __( 'Write quote…' ) } /> { ( ( citation && citation.length > 0 ) || !! focus ) && ( setAttributes( { citation: nextCitation, @@ -172,7 +183,7 @@ registerBlockType( 'core/quote', { key={ i } style={ { textAlign: align ? align : null } } > - { paragraph } + { isString( paragraph ) ? paragraph : paragraph.props.children } ) ) } { citation && citation.length > 0 && ( diff --git a/blocks/library/quote/style.scss b/blocks/library/quote/style.scss index 71f55c72e862ae..7023cebb1e63d3 100644 --- a/blocks/library/quote/style.scss +++ b/blocks/library/quote/style.scss @@ -1,33 +1,4 @@ -.blocks-quote { - margin: 0; - box-shadow: inset 0px 0px 0px 0px $light-gray-500; - - footer { - color: $dark-gray-100; - margin-left: 1.3em; - margin-top: 1em; - position: relative; - font-size: $default-font-size; - font-style: normal; - - &:before { - content: '— '; - position: absolute; - left: -1.3em; - top: 0; - } - } -} - -.editor-visual-editor .blocks-quote-style-1 { - border-left: 4px solid $black; - padding-left: 1em; -} - -.editor-visual-editor .blocks-quote-style-2 { - padding: 0 1em; - & > .blocks-editable p { - font-size: 24px; - font-style: italic; - } +.wp-block-quote.blocks-quote-style-2 > .blocks-editable p { + font-size: 24px; + font-style: italic; } diff --git a/blocks/library/separator/style.scss b/blocks/library/separator/block.scss similarity index 81% rename from blocks/library/separator/style.scss rename to blocks/library/separator/block.scss index 8612d369395b72..37561623928515 100644 --- a/blocks/library/separator/style.scss +++ b/blocks/library/separator/block.scss @@ -1,4 +1,4 @@ -.blocks-separator { +.wp-block-separator { border: none; border-bottom: 2px solid $dark-gray-100; max-width: 100px; diff --git a/blocks/library/separator/index.js b/blocks/library/separator/index.js index aa54c61eac3d3d..a4bc70249bfadb 100644 --- a/blocks/library/separator/index.js +++ b/blocks/library/separator/index.js @@ -1,18 +1,23 @@ +/** + * WordPress dependencies + */ +import { __ } from 'i18n'; + /** * Internal dependencies */ -import './style.scss'; +import './block.scss'; import { registerBlockType } from '../../api'; registerBlockType( 'core/separator', { - title: wp.i18n.__( 'Separator' ), + title: __( 'Separator' ), icon: 'minus', category: 'layout', - edit() { - return
; + edit( { className } ) { + return
; }, save() { diff --git a/blocks/library/table/index.js b/blocks/library/table/index.js index 3acc0ad7eccb72..d90c03abae3d5d 100644 --- a/blocks/library/table/index.js +++ b/blocks/library/table/index.js @@ -1,3 +1,9 @@ +/** + * WordPress dependencies + */ +import { __ } from 'i18n'; +import { createElement } from 'element'; + /** * Internal dependencies */ @@ -10,7 +16,7 @@ import BlockAlignmentToolbar from '../../block-alignment-toolbar'; const { children, query } = hpq; registerBlockType( 'core/table', { - title: wp.i18n.__( 'Table' ), + title: __( 'Table' ), icon: 'editor-table', category: 'formatting', @@ -31,7 +37,7 @@ registerBlockType( 'core/table', { } }, - edit( { attributes, setAttributes, focus, setFocus } ) { + edit( { attributes, setAttributes, focus, setFocus, className } ) { const focussedKey = focus ? focus.editable || 'body.0.0' : null; const updateAlignment = ( nextAlign ) => setAttributes( { align: nextAlign } ); @@ -45,10 +51,10 @@ registerBlockType( 'core/table', { />+
{ [ 'head', 'body', 'foot' ].map( ( part ) => attributes[ part ] && attributes[ part ].length - ? wp.element.createElement( 't' + part, { key: part }, + ? createElement( 't' + part, { key: part }, attributes[ part ].map( ( rows = [], i ) =>
{ rows.map( ( value = '', ii ) => { @@ -87,7 +93,7 @@ registerBlockType( 'core/table', { { [ 'head', 'body', 'foot' ].map( ( part ) => attributes[ part ] && attributes[ part ].length - ? wp.element.createElement( 't' + part, { key: part }, + ? createElement( 't' + part, { key: part }, attributes[ part ].map( ( rows = [], i ) =>
{ rows.map( ( value = '', ii ) => { diff --git a/blocks/library/text/block.scss b/blocks/library/text/block.scss new file mode 100644 index 00000000000000..1cc6bd7b2ff4da --- /dev/null +++ b/blocks/library/text/block.scss @@ -0,0 +1,16 @@ +p.has-drop-cap { + &:first-letter { + float: left; + font-size: 4.1em; + line-height: 0.7; + font-family: serif; + font-weight: bold; + margin: .07em .23em 0 0; + text-transform: uppercase; + font-style: normal; + } +} + +p.has-drop-cap:not( :focus ) { + overflow: hidden; +} diff --git a/blocks/library/text/index.js b/blocks/library/text/index.js index 4ccb3b8beea74d..644a9213812d52 100644 --- a/blocks/library/text/index.js +++ b/blocks/library/text/index.js @@ -2,16 +2,19 @@ * WordPress dependencies */ import { __ } from 'i18n'; -import Toggle from 'components/form-toggle'; +import { concatChildren } from 'element'; /** * Internal dependencies */ +import './block.scss'; import { registerBlockType, createBlock, query as hpq, setDefaultBlock } from '../../api'; import AlignmentToolbar from '../../alignment-toolbar'; import BlockControls from '../../block-controls'; import Editable from '../../editable'; import InspectorControls from '../../inspector-controls'; +import ToggleControl from '../../inspector-controls/toggle-control'; +import BlockDescription from '../../block-description'; const { children, query } = hpq; @@ -22,13 +25,15 @@ registerBlockType( 'core/text', { category: 'common', + className: false, + attributes: { content: query( 'p', children() ), }, merge( attributes, attributesToMerge ) { return { - content: wp.element.concatChildren( attributes.content, attributesToMerge.content ), + content: concatChildren( attributes.content, attributesToMerge.content ), }; }, @@ -48,14 +53,15 @@ registerBlockType( 'core/text', { ), focus && ( - ),- -+- + +{ __( 'Text. Great things start here.' ) }
+{ __( 'Text Settings' ) }
+, ]; }, save( { attributes } ) { - const { align, content } = attributes; + const { align, content, dropCap } = attributes; + const className = dropCap && 'has-drop-cap'; if ( ! align ) { - return { content }
; + return{ content }
; } - return{ content }
; + return{ content }
; }, } ); diff --git a/blocks/media-upload-button/index.js b/blocks/media-upload-button/index.js index f743ef71290765..81cd6f5445265e 100644 --- a/blocks/media-upload-button/index.js +++ b/blocks/media-upload-button/index.js @@ -10,6 +10,7 @@ class MediaUploadButton extends Component { super( ...arguments ); this.openModal = this.openModal.bind( this ); this.onSelect = this.onSelect.bind( this ); + this.onOpen = this.onOpen.bind( this ); const frameConfig = { title: __( 'Select or Upload a media' ), button: { @@ -24,6 +25,7 @@ class MediaUploadButton extends Component { // When an image is selected in the media frame... this.frame.on( 'select', this.onSelect ); + this.frame.on( 'open', this.onOpen ); } componentDidMount() { @@ -43,6 +45,25 @@ class MediaUploadButton extends Component { onSelect( multiple ? attachment : attachment[ 0 ] ); } + onOpen() { + const selection = this.frame.state().get( 'selection' ); + const addMedia = ( id ) => { + const attachment = wp.media.attachment( id ); + attachment.fetch(); + selection.add( attachment ); + }; + + if ( ! this.props.value ) { + return; + } + + if ( this.props.multiple ) { + this.props.value.map( addMedia ); + } else { + addMedia( this.props.value ); + } + } + openModal() { this.frame.open(); } diff --git a/blocks/test/fixtures/README.md b/blocks/test/fixtures/README.md index b17018f85c88c2..9be327c967bcf0 100644 --- a/blocks/test/fixtures/README.md +++ b/blocks/test/fixtures/README.md @@ -3,28 +3,31 @@ This directory contains sets of fixture files that are used to test the parsing and serialization logic. -Each test is made up of three fixture files: +Each test is made up of four fixture files: 1. `fixture-name.html`: The initial post content. -2. `fixture-name.json`: The **expected** parsed representation of the block(s) - inside the post content, along with their attributes and any nested content. - The contents of this file are compared against the **actual** parsed block - object(s). -3. `fixture-name.serialized.html`: The **expected** result of calling +2. `fixture-name.parsed.json`: The **expected** output of the PEG parser for + this content (checked against the **actual** output of both the JS and PHP + versions of the parser). +3. `fixture-name.json`: The **expected** representation of the block(s) inside + the post content, along with their attributes and any nested content. The + contents of this file are compared against the **actual** block object(s). +4. `fixture-name.serialized.html`: The **expected** result of calling `serialize` on the parsed block object(s). The contents of this file are compared against the **actual** re-serialized post content. This final step simulates opening and re-saving a post. Every block is required to have at least one such set of fixture files to test the parsing and serialization of that block. These fixtures must be named like -`core-blockname{-*,}.{html,json,serialized.html}`. For example, for the -`core/image` block, the following three fixture files must exist: +`core__blockname{__*,}.{html,json,serialized.html}`. For example, for the +`core/image` block, the following four fixture files must exist: -1. `core-image.html` (or `core-image-specific-test-name.html`). Must contain a - `` block. -2. `core-image.json` (or `core-image-specific-test-name.html`). -3. `core-image.serialized.html` (or - `core-image-specific-test-name.serialized.html`). +1. `core__image.html` (or `core__image__specific-test-name.html`). Must + contain a `` block. +2. `core__image.parsed.json` (or `core__image__specific-test-name.parsed.json`). +3. `core__image.json` (or `core__image__specific-test-name.json`). +4. `core__image.serialized.html` (or + `core__image__specific-test-name.serialized.html`). Ideally all important attributes and features of the block should be tested this way. New contributions in the form of additional test cases are always @@ -32,7 +35,7 @@ welcome - this is a great way for us to identify bugs and prevent them from recurring in the future. When adding a new test, it's only necessary to create file (1) above, then -there is a command you can run to generate (2) and (3): +there is a command you can run to generate (2) through (4): ```sh GENERATE_MISSING_FIXTURES=y npm run test-unit -- --grep 'full post content fixture' diff --git a/blocks/test/fixtures/core-button-center.html b/blocks/test/fixtures/core-button-center.html deleted file mode 100644 index b80f97864c2935..00000000000000 --- a/blocks/test/fixtures/core-button-center.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/blocks/test/fixtures/core-button-center.serialized.html b/blocks/test/fixtures/core-button-center.serialized.html deleted file mode 100644 index c360f9e247a91c..00000000000000 --- a/blocks/test/fixtures/core-button-center.serialized.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/blocks/test/fixtures/core-embed__animoto.html b/blocks/test/fixtures/core-embed__animoto.html new file mode 100644 index 00000000000000..b805520078110d --- /dev/null +++ b/blocks/test/fixtures/core-embed__animoto.html @@ -0,0 +1,6 @@ + ++ https://animoto.com/ + + diff --git a/blocks/test/fixtures/core-embedanimoto.json b/blocks/test/fixtures/core-embed__animoto.json similarity index 84% rename from blocks/test/fixtures/core-embedanimoto.json rename to blocks/test/fixtures/core-embed__animoto.json index 4f2cbc392247d7..28c7c26cd2cc2a 100644 --- a/blocks/test/fixtures/core-embedanimoto.json +++ b/blocks/test/fixtures/core-embed__animoto.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedanimoto", + "name": "core-embed/animoto", "attributes": { "url": "https://animoto.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__animoto.parsed.json b/blocks/test/fixtures/core-embed__animoto.parsed.json new file mode 100644 index 00000000000000..8650b4f32fbe14 --- /dev/null +++ b/blocks/test/fixtures/core-embed__animoto.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/animoto", + "attrs": { + "url": "https://animoto.com/" + }, + "rawContent": "\nEmbedded content from animoto +\n https://animoto.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__animoto.serialized.html b/blocks/test/fixtures/core-embed__animoto.serialized.html new file mode 100644 index 00000000000000..579267fe3b30e1 --- /dev/null +++ b/blocks/test/fixtures/core-embed__animoto.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from animoto \n+ https://animoto.com/ + + + diff --git a/blocks/test/fixtures/core-embed__cloudup.html b/blocks/test/fixtures/core-embed__cloudup.html new file mode 100644 index 00000000000000..4737f84d4cf72b --- /dev/null +++ b/blocks/test/fixtures/core-embed__cloudup.html @@ -0,0 +1,6 @@ + +Embedded content from animoto ++ https://cloudup.com/ + + diff --git a/blocks/test/fixtures/core-embedcloudup.json b/blocks/test/fixtures/core-embed__cloudup.json similarity index 84% rename from blocks/test/fixtures/core-embedcloudup.json rename to blocks/test/fixtures/core-embed__cloudup.json index 6bda5b3051eef3..22a55a4d296f99 100644 --- a/blocks/test/fixtures/core-embedcloudup.json +++ b/blocks/test/fixtures/core-embed__cloudup.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedcloudup", + "name": "core-embed/cloudup", "attributes": { "url": "https://cloudup.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__cloudup.parsed.json b/blocks/test/fixtures/core-embed__cloudup.parsed.json new file mode 100644 index 00000000000000..eee1502a9e8202 --- /dev/null +++ b/blocks/test/fixtures/core-embed__cloudup.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/cloudup", + "attrs": { + "url": "https://cloudup.com/" + }, + "rawContent": "\nEmbedded content from cloudup +\n https://cloudup.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__cloudup.serialized.html b/blocks/test/fixtures/core-embed__cloudup.serialized.html new file mode 100644 index 00000000000000..5f953aa46c1f4b --- /dev/null +++ b/blocks/test/fixtures/core-embed__cloudup.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from cloudup \n+ https://cloudup.com/ + + + diff --git a/blocks/test/fixtures/core-embed__collegehumor.html b/blocks/test/fixtures/core-embed__collegehumor.html new file mode 100644 index 00000000000000..770c0664896490 --- /dev/null +++ b/blocks/test/fixtures/core-embed__collegehumor.html @@ -0,0 +1,6 @@ + +Embedded content from cloudup ++ https://collegehumor.com/ + + diff --git a/blocks/test/fixtures/core-embedcollegehumor.json b/blocks/test/fixtures/core-embed__collegehumor.json similarity index 83% rename from blocks/test/fixtures/core-embedcollegehumor.json rename to blocks/test/fixtures/core-embed__collegehumor.json index aa9183ead77484..47cff93865c5fa 100644 --- a/blocks/test/fixtures/core-embedcollegehumor.json +++ b/blocks/test/fixtures/core-embed__collegehumor.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedcollegehumor", + "name": "core-embed/collegehumor", "attributes": { "url": "https://collegehumor.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__collegehumor.parsed.json b/blocks/test/fixtures/core-embed__collegehumor.parsed.json new file mode 100644 index 00000000000000..c0170701eae6b0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__collegehumor.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/collegehumor", + "attrs": { + "url": "https://collegehumor.com/" + }, + "rawContent": "\nEmbedded content from collegehumor +\n https://collegehumor.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__collegehumor.serialized.html b/blocks/test/fixtures/core-embed__collegehumor.serialized.html new file mode 100644 index 00000000000000..8234fe93591a38 --- /dev/null +++ b/blocks/test/fixtures/core-embed__collegehumor.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from collegehumor \n+ https://collegehumor.com/ + + + diff --git a/blocks/test/fixtures/core-embed__dailymotion.html b/blocks/test/fixtures/core-embed__dailymotion.html new file mode 100644 index 00000000000000..e1fde0199be096 --- /dev/null +++ b/blocks/test/fixtures/core-embed__dailymotion.html @@ -0,0 +1,6 @@ + +Embedded content from collegehumor ++ https://dailymotion.com/ + + diff --git a/blocks/test/fixtures/core-embeddailymotion.json b/blocks/test/fixtures/core-embed__dailymotion.json similarity index 83% rename from blocks/test/fixtures/core-embeddailymotion.json rename to blocks/test/fixtures/core-embed__dailymotion.json index 44f0b737a76784..4ad16679bf20e9 100644 --- a/blocks/test/fixtures/core-embeddailymotion.json +++ b/blocks/test/fixtures/core-embed__dailymotion.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embeddailymotion", + "name": "core-embed/dailymotion", "attributes": { "url": "https://dailymotion.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__dailymotion.parsed.json b/blocks/test/fixtures/core-embed__dailymotion.parsed.json new file mode 100644 index 00000000000000..d144c58f2b5d16 --- /dev/null +++ b/blocks/test/fixtures/core-embed__dailymotion.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/dailymotion", + "attrs": { + "url": "https://dailymotion.com/" + }, + "rawContent": "\nEmbedded content from dailymotion +\n https://dailymotion.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__dailymotion.serialized.html b/blocks/test/fixtures/core-embed__dailymotion.serialized.html new file mode 100644 index 00000000000000..442c7348cc1e34 --- /dev/null +++ b/blocks/test/fixtures/core-embed__dailymotion.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from dailymotion \n+ https://dailymotion.com/ + + + diff --git a/blocks/test/fixtures/core-embed__facebook.html b/blocks/test/fixtures/core-embed__facebook.html new file mode 100644 index 00000000000000..237516d4065f06 --- /dev/null +++ b/blocks/test/fixtures/core-embed__facebook.html @@ -0,0 +1,6 @@ + +Embedded content from dailymotion ++ https://facebook.com/ + + diff --git a/blocks/test/fixtures/core-embedfacebook.json b/blocks/test/fixtures/core-embed__facebook.json similarity index 84% rename from blocks/test/fixtures/core-embedfacebook.json rename to blocks/test/fixtures/core-embed__facebook.json index 365f7043c6c808..07e08896c62b42 100644 --- a/blocks/test/fixtures/core-embedfacebook.json +++ b/blocks/test/fixtures/core-embed__facebook.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedfacebook", + "name": "core-embed/facebook", "attributes": { "url": "https://facebook.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__facebook.parsed.json b/blocks/test/fixtures/core-embed__facebook.parsed.json new file mode 100644 index 00000000000000..75927b1856bb28 --- /dev/null +++ b/blocks/test/fixtures/core-embed__facebook.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/facebook", + "attrs": { + "url": "https://facebook.com/" + }, + "rawContent": "\nEmbedded content from facebook +\n https://facebook.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__facebook.serialized.html b/blocks/test/fixtures/core-embed__facebook.serialized.html new file mode 100644 index 00000000000000..75b045a5d87e15 --- /dev/null +++ b/blocks/test/fixtures/core-embed__facebook.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from facebook \n+ https://facebook.com/ + + + diff --git a/blocks/test/fixtures/core-embed__flickr.html b/blocks/test/fixtures/core-embed__flickr.html new file mode 100644 index 00000000000000..b39f132e964bf3 --- /dev/null +++ b/blocks/test/fixtures/core-embed__flickr.html @@ -0,0 +1,6 @@ + +Embedded content from facebook ++ https://flickr.com/ + + diff --git a/blocks/test/fixtures/core-embedflickr.json b/blocks/test/fixtures/core-embed__flickr.json similarity index 84% rename from blocks/test/fixtures/core-embedflickr.json rename to blocks/test/fixtures/core-embed__flickr.json index c4294719f27c10..35c28ec6b70e2f 100644 --- a/blocks/test/fixtures/core-embedflickr.json +++ b/blocks/test/fixtures/core-embed__flickr.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedflickr", + "name": "core-embed/flickr", "attributes": { "url": "https://flickr.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__flickr.parsed.json b/blocks/test/fixtures/core-embed__flickr.parsed.json new file mode 100644 index 00000000000000..3a36dce37fdd2b --- /dev/null +++ b/blocks/test/fixtures/core-embed__flickr.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/flickr", + "attrs": { + "url": "https://flickr.com/" + }, + "rawContent": "\nEmbedded content from flickr +\n https://flickr.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__flickr.serialized.html b/blocks/test/fixtures/core-embed__flickr.serialized.html new file mode 100644 index 00000000000000..ba77735d14d3e0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__flickr.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from flickr \n+ https://flickr.com/ + + + diff --git a/blocks/test/fixtures/core-embed__funnyordie.html b/blocks/test/fixtures/core-embed__funnyordie.html new file mode 100644 index 00000000000000..5adf1408411359 --- /dev/null +++ b/blocks/test/fixtures/core-embed__funnyordie.html @@ -0,0 +1,6 @@ + +Embedded content from flickr ++ https://funnyordie.com/ + + diff --git a/blocks/test/fixtures/core-embedfunnyordie.json b/blocks/test/fixtures/core-embed__funnyordie.json similarity index 83% rename from blocks/test/fixtures/core-embedfunnyordie.json rename to blocks/test/fixtures/core-embed__funnyordie.json index a4787f0a9350ab..575ed6342f43b6 100644 --- a/blocks/test/fixtures/core-embedfunnyordie.json +++ b/blocks/test/fixtures/core-embed__funnyordie.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedfunnyordie", + "name": "core-embed/funnyordie", "attributes": { "url": "https://funnyordie.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__funnyordie.parsed.json b/blocks/test/fixtures/core-embed__funnyordie.parsed.json new file mode 100644 index 00000000000000..8926a608389376 --- /dev/null +++ b/blocks/test/fixtures/core-embed__funnyordie.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/funnyordie", + "attrs": { + "url": "https://funnyordie.com/" + }, + "rawContent": "\nEmbedded content from funnyordie +\n https://funnyordie.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__funnyordie.serialized.html b/blocks/test/fixtures/core-embed__funnyordie.serialized.html new file mode 100644 index 00000000000000..608b9901f0d351 --- /dev/null +++ b/blocks/test/fixtures/core-embed__funnyordie.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from funnyordie \n+ https://funnyordie.com/ + + + diff --git a/blocks/test/fixtures/core-embed__hulu.html b/blocks/test/fixtures/core-embed__hulu.html new file mode 100644 index 00000000000000..44a96f4ec070f3 --- /dev/null +++ b/blocks/test/fixtures/core-embed__hulu.html @@ -0,0 +1,6 @@ + +Embedded content from funnyordie ++ https://hulu.com/ + + diff --git a/blocks/test/fixtures/core-embedhulu.json b/blocks/test/fixtures/core-embed__hulu.json similarity index 85% rename from blocks/test/fixtures/core-embedhulu.json rename to blocks/test/fixtures/core-embed__hulu.json index 7cbe2cd792d5fc..35baceb73b1c0c 100644 --- a/blocks/test/fixtures/core-embedhulu.json +++ b/blocks/test/fixtures/core-embed__hulu.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedhulu", + "name": "core-embed/hulu", "attributes": { "url": "https://hulu.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__hulu.parsed.json b/blocks/test/fixtures/core-embed__hulu.parsed.json new file mode 100644 index 00000000000000..ed9ca2f221cda0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__hulu.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/hulu", + "attrs": { + "url": "https://hulu.com/" + }, + "rawContent": "\nEmbedded content from hulu +\n https://hulu.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__hulu.serialized.html b/blocks/test/fixtures/core-embed__hulu.serialized.html new file mode 100644 index 00000000000000..dda59ed6003289 --- /dev/null +++ b/blocks/test/fixtures/core-embed__hulu.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from hulu \n+ https://hulu.com/ + + + diff --git a/blocks/test/fixtures/core-embed__imgur.html b/blocks/test/fixtures/core-embed__imgur.html new file mode 100644 index 00000000000000..41cf134f957d20 --- /dev/null +++ b/blocks/test/fixtures/core-embed__imgur.html @@ -0,0 +1,6 @@ + +Embedded content from hulu ++ https://imgur.com/ + + diff --git a/blocks/test/fixtures/core-embedimgur.json b/blocks/test/fixtures/core-embed__imgur.json similarity index 84% rename from blocks/test/fixtures/core-embedimgur.json rename to blocks/test/fixtures/core-embed__imgur.json index e0a7537ddcbc4c..ea3b38321bec05 100644 --- a/blocks/test/fixtures/core-embedimgur.json +++ b/blocks/test/fixtures/core-embed__imgur.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedimgur", + "name": "core-embed/imgur", "attributes": { "url": "https://imgur.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__imgur.parsed.json b/blocks/test/fixtures/core-embed__imgur.parsed.json new file mode 100644 index 00000000000000..347f7030ce9da7 --- /dev/null +++ b/blocks/test/fixtures/core-embed__imgur.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/imgur", + "attrs": { + "url": "https://imgur.com/" + }, + "rawContent": "\nEmbedded content from imgur +\n https://imgur.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__imgur.serialized.html b/blocks/test/fixtures/core-embed__imgur.serialized.html new file mode 100644 index 00000000000000..ad14cbe6c84c4f --- /dev/null +++ b/blocks/test/fixtures/core-embed__imgur.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from imgur \n+ https://imgur.com/ + + + diff --git a/blocks/test/fixtures/core-embed__instagram.html b/blocks/test/fixtures/core-embed__instagram.html new file mode 100644 index 00000000000000..3cf13efbc3e9c7 --- /dev/null +++ b/blocks/test/fixtures/core-embed__instagram.html @@ -0,0 +1,6 @@ + +Embedded content from imgur ++ https://instagram.com/ + + diff --git a/blocks/test/fixtures/core-embedinstagram.json b/blocks/test/fixtures/core-embed__instagram.json similarity index 83% rename from blocks/test/fixtures/core-embedinstagram.json rename to blocks/test/fixtures/core-embed__instagram.json index a2d7ea8e095e50..b47836c1c0daa2 100644 --- a/blocks/test/fixtures/core-embedinstagram.json +++ b/blocks/test/fixtures/core-embed__instagram.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedinstagram", + "name": "core-embed/instagram", "attributes": { "url": "https://instagram.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__instagram.parsed.json b/blocks/test/fixtures/core-embed__instagram.parsed.json new file mode 100644 index 00000000000000..a2bce58ca6c554 --- /dev/null +++ b/blocks/test/fixtures/core-embed__instagram.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/instagram", + "attrs": { + "url": "https://instagram.com/" + }, + "rawContent": "\nEmbedded content from instagram +\n https://instagram.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__instagram.serialized.html b/blocks/test/fixtures/core-embed__instagram.serialized.html new file mode 100644 index 00000000000000..358a54d0fbd2a0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__instagram.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from instagram \n+ https://instagram.com/ + + + diff --git a/blocks/test/fixtures/core-embed__issuu.html b/blocks/test/fixtures/core-embed__issuu.html new file mode 100644 index 00000000000000..41f8a3e556edcf --- /dev/null +++ b/blocks/test/fixtures/core-embed__issuu.html @@ -0,0 +1,6 @@ + +Embedded content from instagram ++ https://issuu.com/ + + diff --git a/blocks/test/fixtures/core-embedissuu.json b/blocks/test/fixtures/core-embed__issuu.json similarity index 84% rename from blocks/test/fixtures/core-embedissuu.json rename to blocks/test/fixtures/core-embed__issuu.json index f1513bd35f5b05..868cd489e5c387 100644 --- a/blocks/test/fixtures/core-embedissuu.json +++ b/blocks/test/fixtures/core-embed__issuu.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedissuu", + "name": "core-embed/issuu", "attributes": { "url": "https://issuu.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__issuu.parsed.json b/blocks/test/fixtures/core-embed__issuu.parsed.json new file mode 100644 index 00000000000000..8295d85605975f --- /dev/null +++ b/blocks/test/fixtures/core-embed__issuu.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/issuu", + "attrs": { + "url": "https://issuu.com/" + }, + "rawContent": "\nEmbedded content from issuu +\n https://issuu.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__issuu.serialized.html b/blocks/test/fixtures/core-embed__issuu.serialized.html new file mode 100644 index 00000000000000..e97013bd9c8753 --- /dev/null +++ b/blocks/test/fixtures/core-embed__issuu.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from issuu \n+ https://issuu.com/ + + + diff --git a/blocks/test/fixtures/core-embed__kickstarter.html b/blocks/test/fixtures/core-embed__kickstarter.html new file mode 100644 index 00000000000000..3032298f35bfd0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__kickstarter.html @@ -0,0 +1,6 @@ + +Embedded content from issuu ++ https://kickstarter.com/ + + diff --git a/blocks/test/fixtures/core-embedkickstarter.json b/blocks/test/fixtures/core-embed__kickstarter.json similarity index 83% rename from blocks/test/fixtures/core-embedkickstarter.json rename to blocks/test/fixtures/core-embed__kickstarter.json index cc0a212d539e75..e917cfa1e3385e 100644 --- a/blocks/test/fixtures/core-embedkickstarter.json +++ b/blocks/test/fixtures/core-embed__kickstarter.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedkickstarter", + "name": "core-embed/kickstarter", "attributes": { "url": "https://kickstarter.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__kickstarter.parsed.json b/blocks/test/fixtures/core-embed__kickstarter.parsed.json new file mode 100644 index 00000000000000..ec5e4da18a7b4e --- /dev/null +++ b/blocks/test/fixtures/core-embed__kickstarter.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/kickstarter", + "attrs": { + "url": "https://kickstarter.com/" + }, + "rawContent": "\nEmbedded content from kickstarter +\n https://kickstarter.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__kickstarter.serialized.html b/blocks/test/fixtures/core-embed__kickstarter.serialized.html new file mode 100644 index 00000000000000..b35e710436b46e --- /dev/null +++ b/blocks/test/fixtures/core-embed__kickstarter.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from kickstarter \n+ https://kickstarter.com/ + + + diff --git a/blocks/test/fixtures/core-embed__meetup-com.html b/blocks/test/fixtures/core-embed__meetup-com.html new file mode 100644 index 00000000000000..221881f0bf8ae7 --- /dev/null +++ b/blocks/test/fixtures/core-embed__meetup-com.html @@ -0,0 +1,6 @@ + +Embedded content from kickstarter ++ https://meetup.com/ + + diff --git a/blocks/test/fixtures/core-embed__meetup-com.json b/blocks/test/fixtures/core-embed__meetup-com.json new file mode 100644 index 00000000000000..f29968f9082869 --- /dev/null +++ b/blocks/test/fixtures/core-embed__meetup-com.json @@ -0,0 +1,12 @@ +[ + { + "uid": "_uid_0", + "name": "core-embed/meetup-com", + "attributes": { + "url": "https://meetup.com/", + "caption": [ + "Embedded content from meetup-com" + ] + } + } +] diff --git a/blocks/test/fixtures/core-embed__meetup-com.parsed.json b/blocks/test/fixtures/core-embed__meetup-com.parsed.json new file mode 100644 index 00000000000000..55e12e8a55f310 --- /dev/null +++ b/blocks/test/fixtures/core-embed__meetup-com.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/meetup-com", + "attrs": { + "url": "https://meetup.com/" + }, + "rawContent": "\nEmbedded content from meetup-com +\n https://meetup.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__meetup-com.serialized.html b/blocks/test/fixtures/core-embed__meetup-com.serialized.html new file mode 100644 index 00000000000000..c2bb49382b4ffd --- /dev/null +++ b/blocks/test/fixtures/core-embed__meetup-com.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from meetup-com \n+ https://meetup.com/ + + + diff --git a/blocks/test/fixtures/core-embed__mixcloud.html b/blocks/test/fixtures/core-embed__mixcloud.html new file mode 100644 index 00000000000000..f88ce4620ea62f --- /dev/null +++ b/blocks/test/fixtures/core-embed__mixcloud.html @@ -0,0 +1,6 @@ + +Embedded content from meetup-com ++ https://mixcloud.com/ + + diff --git a/blocks/test/fixtures/core-embedmixcloud.json b/blocks/test/fixtures/core-embed__mixcloud.json similarity index 84% rename from blocks/test/fixtures/core-embedmixcloud.json rename to blocks/test/fixtures/core-embed__mixcloud.json index f59153c7e00ea2..1594c158acbe68 100644 --- a/blocks/test/fixtures/core-embedmixcloud.json +++ b/blocks/test/fixtures/core-embed__mixcloud.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedmixcloud", + "name": "core-embed/mixcloud", "attributes": { "url": "https://mixcloud.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__mixcloud.parsed.json b/blocks/test/fixtures/core-embed__mixcloud.parsed.json new file mode 100644 index 00000000000000..9ae1b7ce80d37a --- /dev/null +++ b/blocks/test/fixtures/core-embed__mixcloud.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/mixcloud", + "attrs": { + "url": "https://mixcloud.com/" + }, + "rawContent": "\nEmbedded content from mixcloud +\n https://mixcloud.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__mixcloud.serialized.html b/blocks/test/fixtures/core-embed__mixcloud.serialized.html new file mode 100644 index 00000000000000..e6a58ae7662ff5 --- /dev/null +++ b/blocks/test/fixtures/core-embed__mixcloud.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from mixcloud \n+ https://mixcloud.com/ + + + diff --git a/blocks/test/fixtures/core-embed__photobucket.html b/blocks/test/fixtures/core-embed__photobucket.html new file mode 100644 index 00000000000000..045edc2b90b098 --- /dev/null +++ b/blocks/test/fixtures/core-embed__photobucket.html @@ -0,0 +1,6 @@ + +Embedded content from mixcloud ++ https://photobucket.com/ + + diff --git a/blocks/test/fixtures/core-embedphotobucket.json b/blocks/test/fixtures/core-embed__photobucket.json similarity index 83% rename from blocks/test/fixtures/core-embedphotobucket.json rename to blocks/test/fixtures/core-embed__photobucket.json index 36514c153de13a..f8c2148cbcc77a 100644 --- a/blocks/test/fixtures/core-embedphotobucket.json +++ b/blocks/test/fixtures/core-embed__photobucket.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedphotobucket", + "name": "core-embed/photobucket", "attributes": { "url": "https://photobucket.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__photobucket.parsed.json b/blocks/test/fixtures/core-embed__photobucket.parsed.json new file mode 100644 index 00000000000000..d555f9091b5689 --- /dev/null +++ b/blocks/test/fixtures/core-embed__photobucket.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/photobucket", + "attrs": { + "url": "https://photobucket.com/" + }, + "rawContent": "\nEmbedded content from photobucket +\n https://photobucket.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__photobucket.serialized.html b/blocks/test/fixtures/core-embed__photobucket.serialized.html new file mode 100644 index 00000000000000..dac6bfdfd0e045 --- /dev/null +++ b/blocks/test/fixtures/core-embed__photobucket.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from photobucket \n+ https://photobucket.com/ + + + diff --git a/blocks/test/fixtures/core-embed__polldaddy.html b/blocks/test/fixtures/core-embed__polldaddy.html new file mode 100644 index 00000000000000..eaf97d43c9c0b8 --- /dev/null +++ b/blocks/test/fixtures/core-embed__polldaddy.html @@ -0,0 +1,6 @@ + +Embedded content from photobucket ++ https://polldaddy.com/ + + diff --git a/blocks/test/fixtures/core-embedpolldaddy.json b/blocks/test/fixtures/core-embed__polldaddy.json similarity index 83% rename from blocks/test/fixtures/core-embedpolldaddy.json rename to blocks/test/fixtures/core-embed__polldaddy.json index 018a0e1c5ea4ef..05e4cbeaf045c3 100644 --- a/blocks/test/fixtures/core-embedpolldaddy.json +++ b/blocks/test/fixtures/core-embed__polldaddy.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedpolldaddy", + "name": "core-embed/polldaddy", "attributes": { "url": "https://polldaddy.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__polldaddy.parsed.json b/blocks/test/fixtures/core-embed__polldaddy.parsed.json new file mode 100644 index 00000000000000..6629a355f0e9b9 --- /dev/null +++ b/blocks/test/fixtures/core-embed__polldaddy.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/polldaddy", + "attrs": { + "url": "https://polldaddy.com/" + }, + "rawContent": "\nEmbedded content from polldaddy +\n https://polldaddy.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__polldaddy.serialized.html b/blocks/test/fixtures/core-embed__polldaddy.serialized.html new file mode 100644 index 00000000000000..d124765b91db0d --- /dev/null +++ b/blocks/test/fixtures/core-embed__polldaddy.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from polldaddy \n+ https://polldaddy.com/ + + + diff --git a/blocks/test/fixtures/core-embed__reddit.html b/blocks/test/fixtures/core-embed__reddit.html new file mode 100644 index 00000000000000..dbdf756fe06c85 --- /dev/null +++ b/blocks/test/fixtures/core-embed__reddit.html @@ -0,0 +1,6 @@ + +Embedded content from polldaddy ++ https://reddit.com/ + + diff --git a/blocks/test/fixtures/core-embedreddit.json b/blocks/test/fixtures/core-embed__reddit.json similarity index 84% rename from blocks/test/fixtures/core-embedreddit.json rename to blocks/test/fixtures/core-embed__reddit.json index 011034075516ea..a04125b76926be 100644 --- a/blocks/test/fixtures/core-embedreddit.json +++ b/blocks/test/fixtures/core-embed__reddit.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedreddit", + "name": "core-embed/reddit", "attributes": { "url": "https://reddit.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__reddit.parsed.json b/blocks/test/fixtures/core-embed__reddit.parsed.json new file mode 100644 index 00000000000000..71d7fd1d48cbb0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__reddit.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/reddit", + "attrs": { + "url": "https://reddit.com/" + }, + "rawContent": "\nEmbedded content from reddit +\n https://reddit.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__reddit.serialized.html b/blocks/test/fixtures/core-embed__reddit.serialized.html new file mode 100644 index 00000000000000..545afe9419afeb --- /dev/null +++ b/blocks/test/fixtures/core-embed__reddit.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from reddit \n+ https://reddit.com/ + + + diff --git a/blocks/test/fixtures/core-embed__reverbnation.html b/blocks/test/fixtures/core-embed__reverbnation.html new file mode 100644 index 00000000000000..5015f02812540c --- /dev/null +++ b/blocks/test/fixtures/core-embed__reverbnation.html @@ -0,0 +1,6 @@ + +Embedded content from reddit ++ https://reverbnation.com/ + + diff --git a/blocks/test/fixtures/core-embedreverbnation.json b/blocks/test/fixtures/core-embed__reverbnation.json similarity index 83% rename from blocks/test/fixtures/core-embedreverbnation.json rename to blocks/test/fixtures/core-embed__reverbnation.json index 44d1f94f2c59c2..de0f5c62ef564d 100644 --- a/blocks/test/fixtures/core-embedreverbnation.json +++ b/blocks/test/fixtures/core-embed__reverbnation.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedreverbnation", + "name": "core-embed/reverbnation", "attributes": { "url": "https://reverbnation.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__reverbnation.parsed.json b/blocks/test/fixtures/core-embed__reverbnation.parsed.json new file mode 100644 index 00000000000000..b06041940dccff --- /dev/null +++ b/blocks/test/fixtures/core-embed__reverbnation.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/reverbnation", + "attrs": { + "url": "https://reverbnation.com/" + }, + "rawContent": "\nEmbedded content from reverbnation +\n https://reverbnation.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__reverbnation.serialized.html b/blocks/test/fixtures/core-embed__reverbnation.serialized.html new file mode 100644 index 00000000000000..d61d5d5b270891 --- /dev/null +++ b/blocks/test/fixtures/core-embed__reverbnation.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from reverbnation \n+ https://reverbnation.com/ + + + diff --git a/blocks/test/fixtures/core-embed__screencast.html b/blocks/test/fixtures/core-embed__screencast.html new file mode 100644 index 00000000000000..69a132e33f867b --- /dev/null +++ b/blocks/test/fixtures/core-embed__screencast.html @@ -0,0 +1,6 @@ + +Embedded content from reverbnation ++ https://screencast.com/ + + diff --git a/blocks/test/fixtures/core-embedscreencast.json b/blocks/test/fixtures/core-embed__screencast.json similarity index 83% rename from blocks/test/fixtures/core-embedscreencast.json rename to blocks/test/fixtures/core-embed__screencast.json index 6dec7a9a1a5322..a34839a87c2435 100644 --- a/blocks/test/fixtures/core-embedscreencast.json +++ b/blocks/test/fixtures/core-embed__screencast.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedscreencast", + "name": "core-embed/screencast", "attributes": { "url": "https://screencast.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__screencast.parsed.json b/blocks/test/fixtures/core-embed__screencast.parsed.json new file mode 100644 index 00000000000000..b32db115366573 --- /dev/null +++ b/blocks/test/fixtures/core-embed__screencast.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/screencast", + "attrs": { + "url": "https://screencast.com/" + }, + "rawContent": "\nEmbedded content from screencast +\n https://screencast.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__screencast.serialized.html b/blocks/test/fixtures/core-embed__screencast.serialized.html new file mode 100644 index 00000000000000..9be1814e0ffdc4 --- /dev/null +++ b/blocks/test/fixtures/core-embed__screencast.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from screencast \n+ https://screencast.com/ + + + diff --git a/blocks/test/fixtures/core-embed__scribd.html b/blocks/test/fixtures/core-embed__scribd.html new file mode 100644 index 00000000000000..5d960344af60dd --- /dev/null +++ b/blocks/test/fixtures/core-embed__scribd.html @@ -0,0 +1,6 @@ + +Embedded content from screencast ++ https://scribd.com/ + + diff --git a/blocks/test/fixtures/core-embedscribd.json b/blocks/test/fixtures/core-embed__scribd.json similarity index 84% rename from blocks/test/fixtures/core-embedscribd.json rename to blocks/test/fixtures/core-embed__scribd.json index 5efcbdf619f5b0..81789fe717be3a 100644 --- a/blocks/test/fixtures/core-embedscribd.json +++ b/blocks/test/fixtures/core-embed__scribd.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedscribd", + "name": "core-embed/scribd", "attributes": { "url": "https://scribd.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__scribd.parsed.json b/blocks/test/fixtures/core-embed__scribd.parsed.json new file mode 100644 index 00000000000000..50922c445263cd --- /dev/null +++ b/blocks/test/fixtures/core-embed__scribd.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/scribd", + "attrs": { + "url": "https://scribd.com/" + }, + "rawContent": "\nEmbedded content from scribd +\n https://scribd.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__scribd.serialized.html b/blocks/test/fixtures/core-embed__scribd.serialized.html new file mode 100644 index 00000000000000..bdddf5f3c65429 --- /dev/null +++ b/blocks/test/fixtures/core-embed__scribd.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from scribd \n+ https://scribd.com/ + + + diff --git a/blocks/test/fixtures/core-embed__slideshare.html b/blocks/test/fixtures/core-embed__slideshare.html new file mode 100644 index 00000000000000..53435e5bafef63 --- /dev/null +++ b/blocks/test/fixtures/core-embed__slideshare.html @@ -0,0 +1,6 @@ + +Embedded content from scribd ++ https://slideshare.com/ + + diff --git a/blocks/test/fixtures/core-embedslideshare.json b/blocks/test/fixtures/core-embed__slideshare.json similarity index 83% rename from blocks/test/fixtures/core-embedslideshare.json rename to blocks/test/fixtures/core-embed__slideshare.json index 9010eb8206755a..db0f30df975a9f 100644 --- a/blocks/test/fixtures/core-embedslideshare.json +++ b/blocks/test/fixtures/core-embed__slideshare.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedslideshare", + "name": "core-embed/slideshare", "attributes": { "url": "https://slideshare.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__slideshare.parsed.json b/blocks/test/fixtures/core-embed__slideshare.parsed.json new file mode 100644 index 00000000000000..523505936a96de --- /dev/null +++ b/blocks/test/fixtures/core-embed__slideshare.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/slideshare", + "attrs": { + "url": "https://slideshare.com/" + }, + "rawContent": "\nEmbedded content from slideshare +\n https://slideshare.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__slideshare.serialized.html b/blocks/test/fixtures/core-embed__slideshare.serialized.html new file mode 100644 index 00000000000000..7e8bd7559e87a4 --- /dev/null +++ b/blocks/test/fixtures/core-embed__slideshare.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from slideshare \n+ https://slideshare.com/ + + + diff --git a/blocks/test/fixtures/core-embed__smugmug.html b/blocks/test/fixtures/core-embed__smugmug.html new file mode 100644 index 00000000000000..2c340e414b6606 --- /dev/null +++ b/blocks/test/fixtures/core-embed__smugmug.html @@ -0,0 +1,6 @@ + +Embedded content from slideshare ++ https://smugmug.com/ + + diff --git a/blocks/test/fixtures/core-embedsmugmug.json b/blocks/test/fixtures/core-embed__smugmug.json similarity index 84% rename from blocks/test/fixtures/core-embedsmugmug.json rename to blocks/test/fixtures/core-embed__smugmug.json index cecab2e26b8e50..5b705c05e5c7d5 100644 --- a/blocks/test/fixtures/core-embedsmugmug.json +++ b/blocks/test/fixtures/core-embed__smugmug.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedsmugmug", + "name": "core-embed/smugmug", "attributes": { "url": "https://smugmug.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__smugmug.parsed.json b/blocks/test/fixtures/core-embed__smugmug.parsed.json new file mode 100644 index 00000000000000..4dba20d68362a2 --- /dev/null +++ b/blocks/test/fixtures/core-embed__smugmug.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/smugmug", + "attrs": { + "url": "https://smugmug.com/" + }, + "rawContent": "\nEmbedded content from smugmug +\n https://smugmug.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__smugmug.serialized.html b/blocks/test/fixtures/core-embed__smugmug.serialized.html new file mode 100644 index 00000000000000..dd32192fa56e61 --- /dev/null +++ b/blocks/test/fixtures/core-embed__smugmug.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from smugmug \n+ https://smugmug.com/ + + + diff --git a/blocks/test/fixtures/core-embed__soundcloud.html b/blocks/test/fixtures/core-embed__soundcloud.html new file mode 100644 index 00000000000000..9bc65d3b98839d --- /dev/null +++ b/blocks/test/fixtures/core-embed__soundcloud.html @@ -0,0 +1,6 @@ + +Embedded content from smugmug ++ https://soundcloud.com/ + + diff --git a/blocks/test/fixtures/core-embedsoundcloud.json b/blocks/test/fixtures/core-embed__soundcloud.json similarity index 83% rename from blocks/test/fixtures/core-embedsoundcloud.json rename to blocks/test/fixtures/core-embed__soundcloud.json index 637ecec8577f85..210360add6681b 100644 --- a/blocks/test/fixtures/core-embedsoundcloud.json +++ b/blocks/test/fixtures/core-embed__soundcloud.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedsoundcloud", + "name": "core-embed/soundcloud", "attributes": { "url": "https://soundcloud.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__soundcloud.parsed.json b/blocks/test/fixtures/core-embed__soundcloud.parsed.json new file mode 100644 index 00000000000000..97553adfaba9f5 --- /dev/null +++ b/blocks/test/fixtures/core-embed__soundcloud.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/soundcloud", + "attrs": { + "url": "https://soundcloud.com/" + }, + "rawContent": "\nEmbedded content from soundcloud +\n https://soundcloud.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__soundcloud.serialized.html b/blocks/test/fixtures/core-embed__soundcloud.serialized.html new file mode 100644 index 00000000000000..61cb25dc74c495 --- /dev/null +++ b/blocks/test/fixtures/core-embed__soundcloud.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from soundcloud \n+ https://soundcloud.com/ + + + diff --git a/blocks/test/fixtures/core-embed__speaker.html b/blocks/test/fixtures/core-embed__speaker.html new file mode 100644 index 00000000000000..c458601cf0ec50 --- /dev/null +++ b/blocks/test/fixtures/core-embed__speaker.html @@ -0,0 +1,6 @@ + +Embedded content from soundcloud ++ https://speaker.com/ + + diff --git a/blocks/test/fixtures/core-embedspeaker.json b/blocks/test/fixtures/core-embed__speaker.json similarity index 84% rename from blocks/test/fixtures/core-embedspeaker.json rename to blocks/test/fixtures/core-embed__speaker.json index 0f0c54b3f0f772..7fea3ba89edbde 100644 --- a/blocks/test/fixtures/core-embedspeaker.json +++ b/blocks/test/fixtures/core-embed__speaker.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedspeaker", + "name": "core-embed/speaker", "attributes": { "url": "https://speaker.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__speaker.parsed.json b/blocks/test/fixtures/core-embed__speaker.parsed.json new file mode 100644 index 00000000000000..127334955b576d --- /dev/null +++ b/blocks/test/fixtures/core-embed__speaker.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/speaker", + "attrs": { + "url": "https://speaker.com/" + }, + "rawContent": "\nEmbedded content from speaker +\n https://speaker.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__speaker.serialized.html b/blocks/test/fixtures/core-embed__speaker.serialized.html new file mode 100644 index 00000000000000..c193768710e72e --- /dev/null +++ b/blocks/test/fixtures/core-embed__speaker.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from speaker \n+ https://speaker.com/ + + + diff --git a/blocks/test/fixtures/core-embed__spotify.html b/blocks/test/fixtures/core-embed__spotify.html new file mode 100644 index 00000000000000..a4713c74edf9e0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__spotify.html @@ -0,0 +1,6 @@ + +Embedded content from speaker ++ https://spotify.com/ + + diff --git a/blocks/test/fixtures/core-embedspotify.json b/blocks/test/fixtures/core-embed__spotify.json similarity index 84% rename from blocks/test/fixtures/core-embedspotify.json rename to blocks/test/fixtures/core-embed__spotify.json index 2e712f86c1ec4a..2e1076dbb0c5fd 100644 --- a/blocks/test/fixtures/core-embedspotify.json +++ b/blocks/test/fixtures/core-embed__spotify.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedspotify", + "name": "core-embed/spotify", "attributes": { "url": "https://spotify.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__spotify.parsed.json b/blocks/test/fixtures/core-embed__spotify.parsed.json new file mode 100644 index 00000000000000..0c3167f1dc130f --- /dev/null +++ b/blocks/test/fixtures/core-embed__spotify.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/spotify", + "attrs": { + "url": "https://spotify.com/" + }, + "rawContent": "\nEmbedded content from spotify +\n https://spotify.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__spotify.serialized.html b/blocks/test/fixtures/core-embed__spotify.serialized.html new file mode 100644 index 00000000000000..96b1a511ad1f17 --- /dev/null +++ b/blocks/test/fixtures/core-embed__spotify.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from spotify \n+ https://spotify.com/ + + + diff --git a/blocks/test/fixtures/core-embed__ted.html b/blocks/test/fixtures/core-embed__ted.html new file mode 100644 index 00000000000000..ed6b0ef0ca02ab --- /dev/null +++ b/blocks/test/fixtures/core-embed__ted.html @@ -0,0 +1,6 @@ + +Embedded content from spotify ++ https://ted.com/ + + diff --git a/blocks/test/fixtures/core-embedted.json b/blocks/test/fixtures/core-embed__ted.json similarity index 85% rename from blocks/test/fixtures/core-embedted.json rename to blocks/test/fixtures/core-embed__ted.json index 13c190858f8c76..5011154882c69f 100644 --- a/blocks/test/fixtures/core-embedted.json +++ b/blocks/test/fixtures/core-embed__ted.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedted", + "name": "core-embed/ted", "attributes": { "url": "https://ted.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__ted.parsed.json b/blocks/test/fixtures/core-embed__ted.parsed.json new file mode 100644 index 00000000000000..6ee770cf1a0831 --- /dev/null +++ b/blocks/test/fixtures/core-embed__ted.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/ted", + "attrs": { + "url": "https://ted.com/" + }, + "rawContent": "\nEmbedded content from ted +\n https://ted.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__ted.serialized.html b/blocks/test/fixtures/core-embed__ted.serialized.html new file mode 100644 index 00000000000000..24e3939e19c336 --- /dev/null +++ b/blocks/test/fixtures/core-embed__ted.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from ted \n+ https://ted.com/ + + + diff --git a/blocks/test/fixtures/core-embed__tumblr.html b/blocks/test/fixtures/core-embed__tumblr.html new file mode 100644 index 00000000000000..6d323c0287889e --- /dev/null +++ b/blocks/test/fixtures/core-embed__tumblr.html @@ -0,0 +1,6 @@ + +Embedded content from ted ++ https://tumblr.com/ + + diff --git a/blocks/test/fixtures/core-embedtumblr.json b/blocks/test/fixtures/core-embed__tumblr.json similarity index 84% rename from blocks/test/fixtures/core-embedtumblr.json rename to blocks/test/fixtures/core-embed__tumblr.json index 17e23cd9a8d0c4..ba37f49055801d 100644 --- a/blocks/test/fixtures/core-embedtumblr.json +++ b/blocks/test/fixtures/core-embed__tumblr.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedtumblr", + "name": "core-embed/tumblr", "attributes": { "url": "https://tumblr.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__tumblr.parsed.json b/blocks/test/fixtures/core-embed__tumblr.parsed.json new file mode 100644 index 00000000000000..dfed848f337c56 --- /dev/null +++ b/blocks/test/fixtures/core-embed__tumblr.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/tumblr", + "attrs": { + "url": "https://tumblr.com/" + }, + "rawContent": "\nEmbedded content from tumblr +\n https://tumblr.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__tumblr.serialized.html b/blocks/test/fixtures/core-embed__tumblr.serialized.html new file mode 100644 index 00000000000000..64d2e470c49d52 --- /dev/null +++ b/blocks/test/fixtures/core-embed__tumblr.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from tumblr \n+ https://tumblr.com/ + + + diff --git a/blocks/test/fixtures/core-embed__twitter.html b/blocks/test/fixtures/core-embed__twitter.html new file mode 100644 index 00000000000000..0c4dea12a0e811 --- /dev/null +++ b/blocks/test/fixtures/core-embed__twitter.html @@ -0,0 +1,6 @@ + +Embedded content from tumblr ++ https://twitter.com/automattic + + diff --git a/blocks/test/fixtures/core-embedtwitter.json b/blocks/test/fixtures/core-embed__twitter.json similarity index 84% rename from blocks/test/fixtures/core-embedtwitter.json rename to blocks/test/fixtures/core-embed__twitter.json index b9d463c77dcebd..ff35783fbeeaa9 100644 --- a/blocks/test/fixtures/core-embedtwitter.json +++ b/blocks/test/fixtures/core-embed__twitter.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedtwitter", + "name": "core-embed/twitter", "attributes": { "url": "https://twitter.com/automattic", "caption": [ diff --git a/blocks/test/fixtures/core-embed__twitter.parsed.json b/blocks/test/fixtures/core-embed__twitter.parsed.json new file mode 100644 index 00000000000000..d6d343f46de5e6 --- /dev/null +++ b/blocks/test/fixtures/core-embed__twitter.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/twitter", + "attrs": { + "url": "https://twitter.com/automattic" + }, + "rawContent": "\nWe are Automattic +\n https://twitter.com/automattic\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__twitter.serialized.html b/blocks/test/fixtures/core-embed__twitter.serialized.html new file mode 100644 index 00000000000000..817d3f66df3b6d --- /dev/null +++ b/blocks/test/fixtures/core-embed__twitter.serialized.html @@ -0,0 +1,7 @@ + +We are Automattic \n+ https://twitter.com/automattic + + + diff --git a/blocks/test/fixtures/core-embed__videopress.html b/blocks/test/fixtures/core-embed__videopress.html new file mode 100644 index 00000000000000..30caf20e702259 --- /dev/null +++ b/blocks/test/fixtures/core-embed__videopress.html @@ -0,0 +1,6 @@ + +We are Automattic ++ https://videopress.com/ + + diff --git a/blocks/test/fixtures/core-embedvideopress.json b/blocks/test/fixtures/core-embed__videopress.json similarity index 83% rename from blocks/test/fixtures/core-embedvideopress.json rename to blocks/test/fixtures/core-embed__videopress.json index 8b8f35ff484b57..65e9458e95d877 100644 --- a/blocks/test/fixtures/core-embedvideopress.json +++ b/blocks/test/fixtures/core-embed__videopress.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedvideopress", + "name": "core-embed/videopress", "attributes": { "url": "https://videopress.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__videopress.parsed.json b/blocks/test/fixtures/core-embed__videopress.parsed.json new file mode 100644 index 00000000000000..5076dc3437aa9b --- /dev/null +++ b/blocks/test/fixtures/core-embed__videopress.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/videopress", + "attrs": { + "url": "https://videopress.com/" + }, + "rawContent": "\nEmbedded content from videopress +\n https://videopress.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__videopress.serialized.html b/blocks/test/fixtures/core-embed__videopress.serialized.html new file mode 100644 index 00000000000000..756ab1521df778 --- /dev/null +++ b/blocks/test/fixtures/core-embed__videopress.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from videopress \n+ https://videopress.com/ + + + diff --git a/blocks/test/fixtures/core-embed__vimeo.html b/blocks/test/fixtures/core-embed__vimeo.html new file mode 100644 index 00000000000000..4f0bbfceb9eafc --- /dev/null +++ b/blocks/test/fixtures/core-embed__vimeo.html @@ -0,0 +1,6 @@ + +Embedded content from videopress ++ https://vimeo.com/ + + diff --git a/blocks/test/fixtures/core-embedvimeo.json b/blocks/test/fixtures/core-embed__vimeo.json similarity index 84% rename from blocks/test/fixtures/core-embedvimeo.json rename to blocks/test/fixtures/core-embed__vimeo.json index 828eea64c814d1..a1f215beed6a8b 100644 --- a/blocks/test/fixtures/core-embedvimeo.json +++ b/blocks/test/fixtures/core-embed__vimeo.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedvimeo", + "name": "core-embed/vimeo", "attributes": { "url": "https://vimeo.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__vimeo.parsed.json b/blocks/test/fixtures/core-embed__vimeo.parsed.json new file mode 100644 index 00000000000000..b25b1ce8b02a74 --- /dev/null +++ b/blocks/test/fixtures/core-embed__vimeo.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/vimeo", + "attrs": { + "url": "https://vimeo.com/" + }, + "rawContent": "\nEmbedded content from vimeo +\n https://vimeo.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__vimeo.serialized.html b/blocks/test/fixtures/core-embed__vimeo.serialized.html new file mode 100644 index 00000000000000..b0914dba977211 --- /dev/null +++ b/blocks/test/fixtures/core-embed__vimeo.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from vimeo \n+ https://vimeo.com/ + + + diff --git a/blocks/test/fixtures/core-embed__vine.html b/blocks/test/fixtures/core-embed__vine.html new file mode 100644 index 00000000000000..3d412392ea304d --- /dev/null +++ b/blocks/test/fixtures/core-embed__vine.html @@ -0,0 +1,6 @@ + +Embedded content from vimeo ++ https://vine.com/ + + diff --git a/blocks/test/fixtures/core-embedvine.json b/blocks/test/fixtures/core-embed__vine.json similarity index 85% rename from blocks/test/fixtures/core-embedvine.json rename to blocks/test/fixtures/core-embed__vine.json index e62878c5dc38a7..af44e8956044ca 100644 --- a/blocks/test/fixtures/core-embedvine.json +++ b/blocks/test/fixtures/core-embed__vine.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedvine", + "name": "core-embed/vine", "attributes": { "url": "https://vine.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__vine.parsed.json b/blocks/test/fixtures/core-embed__vine.parsed.json new file mode 100644 index 00000000000000..a52b9b41090066 --- /dev/null +++ b/blocks/test/fixtures/core-embed__vine.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/vine", + "attrs": { + "url": "https://vine.com/" + }, + "rawContent": "\nEmbedded content from vine +\n https://vine.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__vine.serialized.html b/blocks/test/fixtures/core-embed__vine.serialized.html new file mode 100644 index 00000000000000..52983e6eab6ff0 --- /dev/null +++ b/blocks/test/fixtures/core-embed__vine.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from vine \n+ https://vine.com/ + + + diff --git a/blocks/test/fixtures/core-embed__wordpress-tv.html b/blocks/test/fixtures/core-embed__wordpress-tv.html new file mode 100644 index 00000000000000..c978ca92539bfc --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress-tv.html @@ -0,0 +1,6 @@ + +Embedded content from vine ++ https://wordpress.tv/ + + diff --git a/blocks/test/fixtures/core-embed__wordpress-tv.json b/blocks/test/fixtures/core-embed__wordpress-tv.json new file mode 100644 index 00000000000000..8bf8d711faad06 --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress-tv.json @@ -0,0 +1,12 @@ +[ + { + "uid": "_uid_0", + "name": "core-embed/wordpress-tv", + "attributes": { + "url": "https://wordpress.tv/", + "caption": [ + "Embedded content from wordpress-tv" + ] + } + } +] diff --git a/blocks/test/fixtures/core-embed__wordpress-tv.parsed.json b/blocks/test/fixtures/core-embed__wordpress-tv.parsed.json new file mode 100644 index 00000000000000..1f4427486cee99 --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress-tv.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/wordpress-tv", + "attrs": { + "url": "https://wordpress.tv/" + }, + "rawContent": "\nEmbedded content from wordpress-tv +\n https://wordpress.tv/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__wordpress-tv.serialized.html b/blocks/test/fixtures/core-embed__wordpress-tv.serialized.html new file mode 100644 index 00000000000000..bad4644955123f --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress-tv.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from wordpress-tv \n+ https://wordpress.tv/ + + + diff --git a/blocks/test/fixtures/core-embed__wordpress.html b/blocks/test/fixtures/core-embed__wordpress.html new file mode 100644 index 00000000000000..ebe2b6df83f724 --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress.html @@ -0,0 +1,6 @@ + +Embedded content from wordpress-tv ++ https://wordpress.com/ + + diff --git a/blocks/test/fixtures/core-embedwordpress.json b/blocks/test/fixtures/core-embed__wordpress.json similarity index 83% rename from blocks/test/fixtures/core-embedwordpress.json rename to blocks/test/fixtures/core-embed__wordpress.json index 49ce85cd129344..eb24c5f14258d0 100644 --- a/blocks/test/fixtures/core-embedwordpress.json +++ b/blocks/test/fixtures/core-embed__wordpress.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedwordpress", + "name": "core-embed/wordpress", "attributes": { "url": "https://wordpress.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__wordpress.parsed.json b/blocks/test/fixtures/core-embed__wordpress.parsed.json new file mode 100644 index 00000000000000..283eb9495ab54c --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/wordpress", + "attrs": { + "url": "https://wordpress.com/" + }, + "rawContent": "\nEmbedded content from WordPress +\n https://wordpress.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__wordpress.serialized.html b/blocks/test/fixtures/core-embed__wordpress.serialized.html new file mode 100644 index 00000000000000..220298c9942796 --- /dev/null +++ b/blocks/test/fixtures/core-embed__wordpress.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from WordPress \n+ https://wordpress.com/ + + + diff --git a/blocks/test/fixtures/core-embed__youtube.html b/blocks/test/fixtures/core-embed__youtube.html new file mode 100644 index 00000000000000..f69ae07a8f7200 --- /dev/null +++ b/blocks/test/fixtures/core-embed__youtube.html @@ -0,0 +1,6 @@ + +Embedded content from WordPress ++ https://youtube.com/ + + diff --git a/blocks/test/fixtures/core-embedyoutube.json b/blocks/test/fixtures/core-embed__youtube.json similarity index 84% rename from blocks/test/fixtures/core-embedyoutube.json rename to blocks/test/fixtures/core-embed__youtube.json index 7beb5a715dfef6..e03983346dcee9 100644 --- a/blocks/test/fixtures/core-embedyoutube.json +++ b/blocks/test/fixtures/core-embed__youtube.json @@ -1,7 +1,7 @@ [ { "uid": "_uid_0", - "name": "core/embedyoutube", + "name": "core-embed/youtube", "attributes": { "url": "https://youtube.com/", "caption": [ diff --git a/blocks/test/fixtures/core-embed__youtube.parsed.json b/blocks/test/fixtures/core-embed__youtube.parsed.json new file mode 100644 index 00000000000000..6438051183d908 --- /dev/null +++ b/blocks/test/fixtures/core-embed__youtube.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core-embed/youtube", + "attrs": { + "url": "https://youtube.com/" + }, + "rawContent": "\nEmbedded content from youtube +\n https://youtube.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed__youtube.serialized.html b/blocks/test/fixtures/core-embed__youtube.serialized.html new file mode 100644 index 00000000000000..4fa028c1d6d27c --- /dev/null +++ b/blocks/test/fixtures/core-embed__youtube.serialized.html @@ -0,0 +1,7 @@ + +Embedded content from youtube \n+ https://youtube.com/ + + + diff --git a/blocks/test/fixtures/core-embedanimoto.html b/blocks/test/fixtures/core-embedanimoto.html deleted file mode 100644 index 0e464a377f248d..00000000000000 --- a/blocks/test/fixtures/core-embedanimoto.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from youtube +- https://animoto.com/ - - diff --git a/blocks/test/fixtures/core-embedanimoto.serialized.html b/blocks/test/fixtures/core-embedanimoto.serialized.html deleted file mode 100644 index e33c67b8256d61..00000000000000 --- a/blocks/test/fixtures/core-embedanimoto.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from animoto -- https://animoto.com/ - - - diff --git a/blocks/test/fixtures/core-embedcloudup.html b/blocks/test/fixtures/core-embedcloudup.html deleted file mode 100644 index 4650c84b4b703c..00000000000000 --- a/blocks/test/fixtures/core-embedcloudup.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from animoto -- https://cloudup.com/ - - diff --git a/blocks/test/fixtures/core-embedcloudup.serialized.html b/blocks/test/fixtures/core-embedcloudup.serialized.html deleted file mode 100644 index 02951c1171ec50..00000000000000 --- a/blocks/test/fixtures/core-embedcloudup.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from cloudup -- https://cloudup.com/ - - - diff --git a/blocks/test/fixtures/core-embedcollegehumor.html b/blocks/test/fixtures/core-embedcollegehumor.html deleted file mode 100644 index 5ecdbc3e4dd880..00000000000000 --- a/blocks/test/fixtures/core-embedcollegehumor.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from cloudup -- https://collegehumor.com/ - - diff --git a/blocks/test/fixtures/core-embedcollegehumor.serialized.html b/blocks/test/fixtures/core-embedcollegehumor.serialized.html deleted file mode 100644 index 82ffd18b7c8296..00000000000000 --- a/blocks/test/fixtures/core-embedcollegehumor.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from collegehumor -- https://collegehumor.com/ - - - diff --git a/blocks/test/fixtures/core-embeddailymotion.html b/blocks/test/fixtures/core-embeddailymotion.html deleted file mode 100644 index 08bed7270fe70d..00000000000000 --- a/blocks/test/fixtures/core-embeddailymotion.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from collegehumor -- https://dailymotion.com/ - - diff --git a/blocks/test/fixtures/core-embeddailymotion.serialized.html b/blocks/test/fixtures/core-embeddailymotion.serialized.html deleted file mode 100644 index 62f55871d1e1fc..00000000000000 --- a/blocks/test/fixtures/core-embeddailymotion.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from dailymotion -- https://dailymotion.com/ - - - diff --git a/blocks/test/fixtures/core-embedfacebook.html b/blocks/test/fixtures/core-embedfacebook.html deleted file mode 100644 index 4a5044c13d6cdc..00000000000000 --- a/blocks/test/fixtures/core-embedfacebook.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from dailymotion -- https://facebook.com/ - - diff --git a/blocks/test/fixtures/core-embedfacebook.serialized.html b/blocks/test/fixtures/core-embedfacebook.serialized.html deleted file mode 100644 index efda5813641da2..00000000000000 --- a/blocks/test/fixtures/core-embedfacebook.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from facebook -- https://facebook.com/ - - - diff --git a/blocks/test/fixtures/core-embedflickr.html b/blocks/test/fixtures/core-embedflickr.html deleted file mode 100644 index 2325790efcab2a..00000000000000 --- a/blocks/test/fixtures/core-embedflickr.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from facebook -- https://flickr.com/ - - diff --git a/blocks/test/fixtures/core-embedflickr.serialized.html b/blocks/test/fixtures/core-embedflickr.serialized.html deleted file mode 100644 index 4d86c30f5b8811..00000000000000 --- a/blocks/test/fixtures/core-embedflickr.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from flickr -- https://flickr.com/ - - - diff --git a/blocks/test/fixtures/core-embedfunnyordie.html b/blocks/test/fixtures/core-embedfunnyordie.html deleted file mode 100644 index 67e845a743e95d..00000000000000 --- a/blocks/test/fixtures/core-embedfunnyordie.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from flickr -- https://funnyordie.com/ - - diff --git a/blocks/test/fixtures/core-embedfunnyordie.serialized.html b/blocks/test/fixtures/core-embedfunnyordie.serialized.html deleted file mode 100644 index bba227b1c1956e..00000000000000 --- a/blocks/test/fixtures/core-embedfunnyordie.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from funnyordie -- https://funnyordie.com/ - - - diff --git a/blocks/test/fixtures/core-embedhulu.html b/blocks/test/fixtures/core-embedhulu.html deleted file mode 100644 index 749b3ecb99aeeb..00000000000000 --- a/blocks/test/fixtures/core-embedhulu.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from funnyordie -- https://hulu.com/ - - diff --git a/blocks/test/fixtures/core-embedhulu.serialized.html b/blocks/test/fixtures/core-embedhulu.serialized.html deleted file mode 100644 index c9c5b31537a69a..00000000000000 --- a/blocks/test/fixtures/core-embedhulu.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from hulu -- https://hulu.com/ - - - diff --git a/blocks/test/fixtures/core-embedimgur.html b/blocks/test/fixtures/core-embedimgur.html deleted file mode 100644 index 93f03e68d48d8e..00000000000000 --- a/blocks/test/fixtures/core-embedimgur.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from hulu -- https://imgur.com/ - - diff --git a/blocks/test/fixtures/core-embedimgur.serialized.html b/blocks/test/fixtures/core-embedimgur.serialized.html deleted file mode 100644 index e1e3510c97eab8..00000000000000 --- a/blocks/test/fixtures/core-embedimgur.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from imgur -- https://imgur.com/ - - - diff --git a/blocks/test/fixtures/core-embedinstagram.html b/blocks/test/fixtures/core-embedinstagram.html deleted file mode 100644 index 12dc0d1ec08537..00000000000000 --- a/blocks/test/fixtures/core-embedinstagram.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from imgur -- https://instagram.com/ - - diff --git a/blocks/test/fixtures/core-embedinstagram.serialized.html b/blocks/test/fixtures/core-embedinstagram.serialized.html deleted file mode 100644 index 018a38ab8d52b0..00000000000000 --- a/blocks/test/fixtures/core-embedinstagram.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from instagram -- https://instagram.com/ - - - diff --git a/blocks/test/fixtures/core-embedissuu.html b/blocks/test/fixtures/core-embedissuu.html deleted file mode 100644 index 6849278719bc4d..00000000000000 --- a/blocks/test/fixtures/core-embedissuu.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from instagram -- https://issuu.com/ - - diff --git a/blocks/test/fixtures/core-embedissuu.serialized.html b/blocks/test/fixtures/core-embedissuu.serialized.html deleted file mode 100644 index 18903978bd6e18..00000000000000 --- a/blocks/test/fixtures/core-embedissuu.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from issuu -- https://issuu.com/ - - - diff --git a/blocks/test/fixtures/core-embedkickstarter.html b/blocks/test/fixtures/core-embedkickstarter.html deleted file mode 100644 index dbd11a91fe39b4..00000000000000 --- a/blocks/test/fixtures/core-embedkickstarter.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from issuu -- https://kickstarter.com/ - - diff --git a/blocks/test/fixtures/core-embedkickstarter.serialized.html b/blocks/test/fixtures/core-embedkickstarter.serialized.html deleted file mode 100644 index 600c019a803420..00000000000000 --- a/blocks/test/fixtures/core-embedkickstarter.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from kickstarter -- https://kickstarter.com/ - - - diff --git a/blocks/test/fixtures/core-embedmeetupcom.html b/blocks/test/fixtures/core-embedmeetupcom.html deleted file mode 100644 index f72f0acfcea7e9..00000000000000 --- a/blocks/test/fixtures/core-embedmeetupcom.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from kickstarter -- https://meetupcom.com/ - - diff --git a/blocks/test/fixtures/core-embedmeetupcom.json b/blocks/test/fixtures/core-embedmeetupcom.json deleted file mode 100644 index 5fb470dcd8b6df..00000000000000 --- a/blocks/test/fixtures/core-embedmeetupcom.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "uid": "_uid_0", - "name": "core/embedmeetupcom", - "attributes": { - "url": "https://meetupcom.com/", - "caption": [ - "Embedded content from meetupcom" - ] - } - } -] diff --git a/blocks/test/fixtures/core-embedmeetupcom.serialized.html b/blocks/test/fixtures/core-embedmeetupcom.serialized.html deleted file mode 100644 index c271a0550b38cc..00000000000000 --- a/blocks/test/fixtures/core-embedmeetupcom.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from meetupcom -- https://meetupcom.com/ - - - diff --git a/blocks/test/fixtures/core-embedmixcloud.html b/blocks/test/fixtures/core-embedmixcloud.html deleted file mode 100644 index bf79ac8537924a..00000000000000 --- a/blocks/test/fixtures/core-embedmixcloud.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from meetupcom -- https://mixcloud.com/ - - diff --git a/blocks/test/fixtures/core-embedmixcloud.serialized.html b/blocks/test/fixtures/core-embedmixcloud.serialized.html deleted file mode 100644 index dd53c339d93a03..00000000000000 --- a/blocks/test/fixtures/core-embedmixcloud.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from mixcloud -- https://mixcloud.com/ - - - diff --git a/blocks/test/fixtures/core-embedphotobucket.html b/blocks/test/fixtures/core-embedphotobucket.html deleted file mode 100644 index ba8170950c3729..00000000000000 --- a/blocks/test/fixtures/core-embedphotobucket.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from mixcloud -- https://photobucket.com/ - - diff --git a/blocks/test/fixtures/core-embedphotobucket.serialized.html b/blocks/test/fixtures/core-embedphotobucket.serialized.html deleted file mode 100644 index e2631ab04ceee4..00000000000000 --- a/blocks/test/fixtures/core-embedphotobucket.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from photobucket -- https://photobucket.com/ - - - diff --git a/blocks/test/fixtures/core-embedpolldaddy.html b/blocks/test/fixtures/core-embedpolldaddy.html deleted file mode 100644 index 4176efd62628de..00000000000000 --- a/blocks/test/fixtures/core-embedpolldaddy.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from photobucket -- https://polldaddy.com/ - - diff --git a/blocks/test/fixtures/core-embedpolldaddy.serialized.html b/blocks/test/fixtures/core-embedpolldaddy.serialized.html deleted file mode 100644 index 20f6eba0732f39..00000000000000 --- a/blocks/test/fixtures/core-embedpolldaddy.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from polldaddy -- https://polldaddy.com/ - - - diff --git a/blocks/test/fixtures/core-embedreddit.html b/blocks/test/fixtures/core-embedreddit.html deleted file mode 100644 index 3537909ad8430a..00000000000000 --- a/blocks/test/fixtures/core-embedreddit.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from polldaddy -- https://reddit.com/ - - diff --git a/blocks/test/fixtures/core-embedreddit.serialized.html b/blocks/test/fixtures/core-embedreddit.serialized.html deleted file mode 100644 index 8fda9380fb2093..00000000000000 --- a/blocks/test/fixtures/core-embedreddit.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from reddit -- https://reddit.com/ - - - diff --git a/blocks/test/fixtures/core-embedreverbnation.html b/blocks/test/fixtures/core-embedreverbnation.html deleted file mode 100644 index 3e03c3404f7570..00000000000000 --- a/blocks/test/fixtures/core-embedreverbnation.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from reddit -- https://reverbnation.com/ - - diff --git a/blocks/test/fixtures/core-embedreverbnation.serialized.html b/blocks/test/fixtures/core-embedreverbnation.serialized.html deleted file mode 100644 index 3f5686dad96cf5..00000000000000 --- a/blocks/test/fixtures/core-embedreverbnation.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from reverbnation -- https://reverbnation.com/ - - - diff --git a/blocks/test/fixtures/core-embedscreencast.html b/blocks/test/fixtures/core-embedscreencast.html deleted file mode 100644 index 75e7990c480f78..00000000000000 --- a/blocks/test/fixtures/core-embedscreencast.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from reverbnation -- https://screencast.com/ - - diff --git a/blocks/test/fixtures/core-embedscreencast.serialized.html b/blocks/test/fixtures/core-embedscreencast.serialized.html deleted file mode 100644 index 2d6b5468637692..00000000000000 --- a/blocks/test/fixtures/core-embedscreencast.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from screencast -- https://screencast.com/ - - - diff --git a/blocks/test/fixtures/core-embedscribd.html b/blocks/test/fixtures/core-embedscribd.html deleted file mode 100644 index 4971e8c9438426..00000000000000 --- a/blocks/test/fixtures/core-embedscribd.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from screencast -- https://scribd.com/ - - diff --git a/blocks/test/fixtures/core-embedscribd.serialized.html b/blocks/test/fixtures/core-embedscribd.serialized.html deleted file mode 100644 index 06069125228bdf..00000000000000 --- a/blocks/test/fixtures/core-embedscribd.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from scribd -- https://scribd.com/ - - - diff --git a/blocks/test/fixtures/core-embedslideshare.html b/blocks/test/fixtures/core-embedslideshare.html deleted file mode 100644 index abd33acdf7c46e..00000000000000 --- a/blocks/test/fixtures/core-embedslideshare.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from scribd -- https://slideshare.com/ - - diff --git a/blocks/test/fixtures/core-embedslideshare.serialized.html b/blocks/test/fixtures/core-embedslideshare.serialized.html deleted file mode 100644 index 8184fc98e5a1a6..00000000000000 --- a/blocks/test/fixtures/core-embedslideshare.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from slideshare -- https://slideshare.com/ - - - diff --git a/blocks/test/fixtures/core-embedsmugmug.html b/blocks/test/fixtures/core-embedsmugmug.html deleted file mode 100644 index 7dc99c1cb7dfb2..00000000000000 --- a/blocks/test/fixtures/core-embedsmugmug.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from slideshare -- https://smugmug.com/ - - diff --git a/blocks/test/fixtures/core-embedsmugmug.serialized.html b/blocks/test/fixtures/core-embedsmugmug.serialized.html deleted file mode 100644 index 4755f4de1a2c54..00000000000000 --- a/blocks/test/fixtures/core-embedsmugmug.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from smugmug -- https://smugmug.com/ - - - diff --git a/blocks/test/fixtures/core-embedsoundcloud.html b/blocks/test/fixtures/core-embedsoundcloud.html deleted file mode 100644 index c02c19b249a0b1..00000000000000 --- a/blocks/test/fixtures/core-embedsoundcloud.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from smugmug -- https://soundcloud.com/ - - diff --git a/blocks/test/fixtures/core-embedsoundcloud.serialized.html b/blocks/test/fixtures/core-embedsoundcloud.serialized.html deleted file mode 100644 index 70688f2cad848b..00000000000000 --- a/blocks/test/fixtures/core-embedsoundcloud.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from soundcloud -- https://soundcloud.com/ - - - diff --git a/blocks/test/fixtures/core-embedspeaker.html b/blocks/test/fixtures/core-embedspeaker.html deleted file mode 100644 index a7a9332fff5d2a..00000000000000 --- a/blocks/test/fixtures/core-embedspeaker.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from soundcloud -- https://speaker.com/ - - diff --git a/blocks/test/fixtures/core-embedspeaker.serialized.html b/blocks/test/fixtures/core-embedspeaker.serialized.html deleted file mode 100644 index 77b6efdd62940d..00000000000000 --- a/blocks/test/fixtures/core-embedspeaker.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from speaker -- https://speaker.com/ - - - diff --git a/blocks/test/fixtures/core-embedspotify.html b/blocks/test/fixtures/core-embedspotify.html deleted file mode 100644 index bfe67cb9034fc6..00000000000000 --- a/blocks/test/fixtures/core-embedspotify.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from speaker -- https://spotify.com/ - - diff --git a/blocks/test/fixtures/core-embedspotify.serialized.html b/blocks/test/fixtures/core-embedspotify.serialized.html deleted file mode 100644 index 8e88da9f4e3a27..00000000000000 --- a/blocks/test/fixtures/core-embedspotify.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from spotify -- https://spotify.com/ - - - diff --git a/blocks/test/fixtures/core-embedted.html b/blocks/test/fixtures/core-embedted.html deleted file mode 100644 index eb58f0c2c39497..00000000000000 --- a/blocks/test/fixtures/core-embedted.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from spotify -- https://ted.com/ - - diff --git a/blocks/test/fixtures/core-embedted.serialized.html b/blocks/test/fixtures/core-embedted.serialized.html deleted file mode 100644 index 5a9d51536f5daf..00000000000000 --- a/blocks/test/fixtures/core-embedted.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from ted -- https://ted.com/ - - - diff --git a/blocks/test/fixtures/core-embedtumblr.html b/blocks/test/fixtures/core-embedtumblr.html deleted file mode 100644 index ee07d48e887ba4..00000000000000 --- a/blocks/test/fixtures/core-embedtumblr.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from ted -- https://tumblr.com/ - - diff --git a/blocks/test/fixtures/core-embedtumblr.serialized.html b/blocks/test/fixtures/core-embedtumblr.serialized.html deleted file mode 100644 index 8f1da3fb2e4d98..00000000000000 --- a/blocks/test/fixtures/core-embedtumblr.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from tumblr -- https://tumblr.com/ - - - diff --git a/blocks/test/fixtures/core-embedtwitter.html b/blocks/test/fixtures/core-embedtwitter.html deleted file mode 100644 index 807a6bfd27604d..00000000000000 --- a/blocks/test/fixtures/core-embedtwitter.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from tumblr -- https://twitter.com/automattic - - diff --git a/blocks/test/fixtures/core-embedtwitter.serialized.html b/blocks/test/fixtures/core-embedtwitter.serialized.html deleted file mode 100644 index bc214e661e01e7..00000000000000 --- a/blocks/test/fixtures/core-embedtwitter.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -We are Automattic -- https://twitter.com/automattic - - - diff --git a/blocks/test/fixtures/core-embedvideopress.html b/blocks/test/fixtures/core-embedvideopress.html deleted file mode 100644 index ba2ff6bdc2e51d..00000000000000 --- a/blocks/test/fixtures/core-embedvideopress.html +++ /dev/null @@ -1,6 +0,0 @@ - -We are Automattic -- https://videopress.com/ - - diff --git a/blocks/test/fixtures/core-embedvideopress.serialized.html b/blocks/test/fixtures/core-embedvideopress.serialized.html deleted file mode 100644 index 571972d53ff4dd..00000000000000 --- a/blocks/test/fixtures/core-embedvideopress.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from videopress -- https://videopress.com/ - - - diff --git a/blocks/test/fixtures/core-embedvimeo.html b/blocks/test/fixtures/core-embedvimeo.html deleted file mode 100644 index 81b4698f749c24..00000000000000 --- a/blocks/test/fixtures/core-embedvimeo.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from videopress -- https://vimeo.com/ - - diff --git a/blocks/test/fixtures/core-embedvimeo.serialized.html b/blocks/test/fixtures/core-embedvimeo.serialized.html deleted file mode 100644 index eb1522a937aea1..00000000000000 --- a/blocks/test/fixtures/core-embedvimeo.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from vimeo -- https://vimeo.com/ - - - diff --git a/blocks/test/fixtures/core-embedvine.html b/blocks/test/fixtures/core-embedvine.html deleted file mode 100644 index b70558a5fc77b2..00000000000000 --- a/blocks/test/fixtures/core-embedvine.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from vimeo -- https://vine.com/ - - diff --git a/blocks/test/fixtures/core-embedvine.serialized.html b/blocks/test/fixtures/core-embedvine.serialized.html deleted file mode 100644 index df9496fb94081e..00000000000000 --- a/blocks/test/fixtures/core-embedvine.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from vine -- https://vine.com/ - - - diff --git a/blocks/test/fixtures/core-embedwordpress.html b/blocks/test/fixtures/core-embedwordpress.html deleted file mode 100644 index accd979b51f836..00000000000000 --- a/blocks/test/fixtures/core-embedwordpress.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from vine -- https://wordpress.com/ - - diff --git a/blocks/test/fixtures/core-embedwordpress.serialized.html b/blocks/test/fixtures/core-embedwordpress.serialized.html deleted file mode 100644 index 0905c1b166b45d..00000000000000 --- a/blocks/test/fixtures/core-embedwordpress.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from WordPress -- https://wordpress.com/ - - - diff --git a/blocks/test/fixtures/core-embedwordpresstv.html b/blocks/test/fixtures/core-embedwordpresstv.html deleted file mode 100644 index eca3877f5ced80..00000000000000 --- a/blocks/test/fixtures/core-embedwordpresstv.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from WordPress -- https://wordpresstv.com/ - - diff --git a/blocks/test/fixtures/core-embedwordpresstv.json b/blocks/test/fixtures/core-embedwordpresstv.json deleted file mode 100644 index 43e137a66bdeb8..00000000000000 --- a/blocks/test/fixtures/core-embedwordpresstv.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "uid": "_uid_0", - "name": "core/embedwordpresstv", - "attributes": { - "url": "https://wordpresstv.com/", - "caption": [ - "Embedded content from wordpresstv" - ] - } - } -] diff --git a/blocks/test/fixtures/core-embedwordpresstv.serialized.html b/blocks/test/fixtures/core-embedwordpresstv.serialized.html deleted file mode 100644 index bc6c773f16293d..00000000000000 --- a/blocks/test/fixtures/core-embedwordpresstv.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from wordpresstv -- https://wordpresstv.com/ - - - diff --git a/blocks/test/fixtures/core-embedyoutube.html b/blocks/test/fixtures/core-embedyoutube.html deleted file mode 100644 index e0832c00589d29..00000000000000 --- a/blocks/test/fixtures/core-embedyoutube.html +++ /dev/null @@ -1,6 +0,0 @@ - -Embedded content from wordpresstv -- https://youtube.com/ - - diff --git a/blocks/test/fixtures/core-embedyoutube.serialized.html b/blocks/test/fixtures/core-embedyoutube.serialized.html deleted file mode 100644 index 02fa086d489e79..00000000000000 --- a/blocks/test/fixtures/core-embedyoutube.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -Embedded content from youtube -- https://youtube.com/ - - - diff --git a/blocks/test/fixtures/core-gallery.html b/blocks/test/fixtures/core-gallery.html deleted file mode 100644 index 523a6732dd9597..00000000000000 --- a/blocks/test/fixtures/core-gallery.html +++ /dev/null @@ -1,10 +0,0 @@ - -Embedded content from youtube --- diff --git a/blocks/test/fixtures/core-gallery.json b/blocks/test/fixtures/core-gallery.json deleted file mode 100644 index 4b1abd909fe7fd..00000000000000 --- a/blocks/test/fixtures/core-gallery.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "uid": "_uid_0", - "name": "core/gallery", - "attributes": { - "images": [ - { "url": "https://cldup.com/uuUqE_dXzy.jpg", "alt": "title" }, - { "url": "http://google.com/hi.png", "alt": "title" } - ] - } - } -] diff --git a/blocks/test/fixtures/core-gallery.serialized.html b/blocks/test/fixtures/core-gallery.serialized.html deleted file mode 100644 index 09f55993d4fd97..00000000000000 --- a/blocks/test/fixtures/core-gallery.serialized.html +++ /dev/null @@ -1,7 +0,0 @@ - -- --
- --
-- - diff --git a/blocks/test/fixtures/core-image-center-caption.html b/blocks/test/fixtures/core-image-center-caption.html deleted file mode 100644 index a528bacf467455..00000000000000 --- a/blocks/test/fixtures/core-image-center-caption.html +++ /dev/null @@ -1,3 +0,0 @@ - -- - - diff --git a/blocks/test/fixtures/core-image.html b/blocks/test/fixtures/core-image.html deleted file mode 100644 index 7ca7dd87f9f01a..00000000000000 --- a/blocks/test/fixtures/core-image.html +++ /dev/null @@ -1,3 +0,0 @@ - - Give it a try. Press the "really wide" button on the image toolbar. - diff --git a/blocks/test/fixtures/core-image.serialized.html b/blocks/test/fixtures/core-image.serialized.html deleted file mode 100644 index 2b27696131025b..00000000000000 --- a/blocks/test/fixtures/core-image.serialized.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/blocks/test/fixtures/core-latestposts.html b/blocks/test/fixtures/core-latestposts.html deleted file mode 100644 index ee48abd1b42766..00000000000000 --- a/blocks/test/fixtures/core-latestposts.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/blocks/test/fixtures/core-latestposts.json b/blocks/test/fixtures/core-latestposts.json deleted file mode 100644 index 515a6af9aee5ae..00000000000000 --- a/blocks/test/fixtures/core-latestposts.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - { - "uid": "_uid_0", - "name": "core/latestposts", - "attributes": { - "poststoshow": "5" - } - } -] diff --git a/blocks/test/fixtures/core-latestposts.serialized.html b/blocks/test/fixtures/core-latestposts.serialized.html deleted file mode 100644 index ee48abd1b42766..00000000000000 --- a/blocks/test/fixtures/core-latestposts.serialized.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/blocks/test/fixtures/core-preformatted.html b/blocks/test/fixtures/core-preformatted.html deleted file mode 100644 index 1b3abc31853c09..00000000000000 --- a/blocks/test/fixtures/core-preformatted.html +++ /dev/null @@ -1,3 +0,0 @@ - -
Some preformatted text...- diff --git a/blocks/test/fixtures/core-preformatted.serialized.html b/blocks/test/fixtures/core-preformatted.serialized.html deleted file mode 100644 index b119b914cf0e42..00000000000000 --- a/blocks/test/fixtures/core-preformatted.serialized.html +++ /dev/null @@ -1,4 +0,0 @@ - -
And more!Some preformatted text...- - diff --git a/blocks/test/fixtures/core-quote-style-1.html b/blocks/test/fixtures/core-quote-style-1.html deleted file mode 100644 index e8c9add2748c63..00000000000000 --- a/blocks/test/fixtures/core-quote-style-1.html +++ /dev/null @@ -1,3 +0,0 @@ - -
And more!- diff --git a/blocks/test/fixtures/core-quote-style-1.json b/blocks/test/fixtures/core-quote-style-1.json deleted file mode 100644 index 37815136063030..00000000000000 --- a/blocks/test/fixtures/core-quote-style-1.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "uid": "_uid_0", - "name": "core/quote", - "attributes": { - "style": "1", - "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" - ] - } - } -] diff --git a/blocks/test/fixtures/core-quote-style-2.html b/blocks/test/fixtures/core-quote-style-2.html deleted file mode 100644 index b8c255beee8fe7..00000000000000 --- a/blocks/test/fixtures/core-quote-style-2.html +++ /dev/null @@ -1,3 +0,0 @@ - -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.
- diff --git a/blocks/test/fixtures/core__button__center.html b/blocks/test/fixtures/core__button__center.html new file mode 100644 index 00000000000000..53c3b8c897ad06 --- /dev/null +++ b/blocks/test/fixtures/core__button__center.html @@ -0,0 +1,3 @@ + + + diff --git a/blocks/test/fixtures/core-button-center.json b/blocks/test/fixtures/core__button__center.json similarity index 100% rename from blocks/test/fixtures/core-button-center.json rename to blocks/test/fixtures/core__button__center.json diff --git a/blocks/test/fixtures/core__button__center.parsed.json b/blocks/test/fixtures/core__button__center.parsed.json new file mode 100644 index 00000000000000..e19d7f4991ae7e --- /dev/null +++ b/blocks/test/fixtures/core__button__center.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/button", + "attrs": { + "align": "center" + }, + "rawContent": "\n\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__button__center.serialized.html b/blocks/test/fixtures/core__button__center.serialized.html new file mode 100644 index 00000000000000..67ce1c8adfd300 --- /dev/null +++ b/blocks/test/fixtures/core__button__center.serialized.html @@ -0,0 +1,4 @@ + + + + diff --git a/blocks/test/fixtures/core-code.html b/blocks/test/fixtures/core__code.html similarity index 60% rename from blocks/test/fixtures/core-code.html rename to blocks/test/fixtures/core__code.html index 0c00ab494b2f98..5d3f951c17f71c 100644 --- a/blocks/test/fixtures/core-code.html +++ b/blocks/test/fixtures/core__code.html @@ -1,5 +1,5 @@ -There is no greater agony than bearing an untold story inside you.
export default function MyButton() { +
diff --git a/blocks/test/fixtures/core-code.json b/blocks/test/fixtures/core__code.json similarity index 100% rename from blocks/test/fixtures/core-code.json rename to blocks/test/fixtures/core__code.json diff --git a/blocks/test/fixtures/core__code.parsed.json b/blocks/test/fixtures/core__code.parsed.json new file mode 100644 index 00000000000000..127ba413fcb3cd --- /dev/null +++ b/blocks/test/fixtures/core__code.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/code", + "attrs": null, + "rawContent": "\nexport default function MyButton() { return <Button>Click Me!</Button>; }
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-code.serialized.html b/blocks/test/fixtures/core__code.serialized.html similarity index 60% rename from blocks/test/fixtures/core-code.serialized.html rename to blocks/test/fixtures/core__code.serialized.html index fbf78a33703c00..695395457a7c9e 100644 --- a/blocks/test/fixtures/core-code.serialized.html +++ b/blocks/test/fixtures/core__code.serialized.html @@ -1,5 +1,5 @@ -export default function MyButton() {\n\treturn <Button>Click Me!</Button>;\n}
export default function MyButton() { +
diff --git a/blocks/test/fixtures/core__cover-image.html b/blocks/test/fixtures/core__cover-image.html new file mode 100644 index 00000000000000..ac78109a092e21 --- /dev/null +++ b/blocks/test/fixtures/core__cover-image.html @@ -0,0 +1,7 @@ + +export default function MyButton() { return <Button>Click Me!</Button>; }
+ + diff --git a/blocks/test/fixtures/core__cover-image.json b/blocks/test/fixtures/core__cover-image.json new file mode 100644 index 00000000000000..e76615bc0388e9 --- /dev/null +++ b/blocks/test/fixtures/core__cover-image.json @@ -0,0 +1,10 @@ +[ + { + "uid": "_uid_0", + "name": "core/cover-image", + "attributes": { + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "title": "Guten Berg!" + } + } +] diff --git a/blocks/test/fixtures/core__cover-image.parsed.json b/blocks/test/fixtures/core__cover-image.parsed.json new file mode 100644 index 00000000000000..21afba0f6d0039 --- /dev/null +++ b/blocks/test/fixtures/core__cover-image.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/cover-image", + "attrs": { + "url": "https://cldup.com/uuUqE_dXzy.jpg" + }, + "rawContent": "\n+ +Guten Berg!
+\n\t \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__cover-image.serialized.html b/blocks/test/fixtures/core__cover-image.serialized.html new file mode 100644 index 00000000000000..22def81fcfd94c --- /dev/null +++ b/blocks/test/fixtures/core__cover-image.serialized.html @@ -0,0 +1,8 @@ + +\n\t\t \nGuten Berg!
\n\t+ + + diff --git a/blocks/test/fixtures/core-embed.html b/blocks/test/fixtures/core__embed.html similarity index 59% rename from blocks/test/fixtures/core-embed.html rename to blocks/test/fixtures/core__embed.html index af8b876de71e0d..a75136b0413ef7 100644 --- a/blocks/test/fixtures/core-embed.html +++ b/blocks/test/fixtures/core__embed.html @@ -1,5 +1,5 @@ - -+ +Guten Berg!
++ +https://example.com/ diff --git a/blocks/test/fixtures/core-embed.json b/blocks/test/fixtures/core__embed.json similarity index 100% rename from blocks/test/fixtures/core-embed.json rename to blocks/test/fixtures/core__embed.json diff --git a/blocks/test/fixtures/core__embed.parsed.json b/blocks/test/fixtures/core__embed.parsed.json new file mode 100644 index 00000000000000..d0b20272ef818f --- /dev/null +++ b/blocks/test/fixtures/core__embed.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/embed", + "attrs": { + "url": "https://example.com/" + }, + "rawContent": "\nEmbedded content from an example URL \n https://example.com/\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-embed.serialized.html b/blocks/test/fixtures/core__embed.serialized.html similarity index 59% rename from blocks/test/fixtures/core-embed.serialized.html rename to blocks/test/fixtures/core__embed.serialized.html index b8b1e50e7afef6..2b0842846c40f1 100644 --- a/blocks/test/fixtures/core-embed.serialized.html +++ b/blocks/test/fixtures/core__embed.serialized.html @@ -1,5 +1,5 @@ - -Embedded content from an example URL \n+ +https://example.com/ diff --git a/blocks/test/fixtures/core-freeform.html b/blocks/test/fixtures/core__freeform.html similarity index 100% rename from blocks/test/fixtures/core-freeform.html rename to blocks/test/fixtures/core__freeform.html diff --git a/blocks/test/fixtures/core-freeform.json b/blocks/test/fixtures/core__freeform.json similarity index 100% rename from blocks/test/fixtures/core-freeform.json rename to blocks/test/fixtures/core__freeform.json diff --git a/blocks/test/fixtures/core__freeform.parsed.json b/blocks/test/fixtures/core__freeform.parsed.json new file mode 100644 index 00000000000000..276442f4c7864f --- /dev/null +++ b/blocks/test/fixtures/core__freeform.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/freeform", + "attrs": null, + "rawContent": "\nTesting freeform block with some\nEmbedded content from an example URL \n\tHTML content\n\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-freeform.serialized.html b/blocks/test/fixtures/core__freeform.serialized.html similarity index 75% rename from blocks/test/fixtures/core-freeform.serialized.html rename to blocks/test/fixtures/core__freeform.serialized.html index d30114895dd4c6..a31ee92b0385e5 100644 --- a/blocks/test/fixtures/core-freeform.serialized.html +++ b/blocks/test/fixtures/core__freeform.serialized.html @@ -1,6 +1,6 @@ Testing freeform block with some -+HTML contentdiff --git a/blocks/test/fixtures/core__gallery.html b/blocks/test/fixtures/core__gallery.html new file mode 100644 index 00000000000000..2846a09568013a --- /dev/null +++ b/blocks/test/fixtures/core__gallery.html @@ -0,0 +1,10 @@ + +++ diff --git a/blocks/test/fixtures/core__gallery.json b/blocks/test/fixtures/core__gallery.json new file mode 100644 index 00000000000000..aa42f70c3990a2 --- /dev/null +++ b/blocks/test/fixtures/core__gallery.json @@ -0,0 +1,42 @@ +[ + { + "uid": "_uid_0", + "name": "core/gallery", + "attributes": { + "images": [ + { + "sizes": { + "full": { + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "height": 1080, + "width": 810, + "orientation": "portrait" + } + }, + "mime": "image/jpeg", + "type": "image", + "subtype": "jpeg", + "id": 1, + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "alt": "title" + }, + { + "sizes": { + "full": { + "url": "http://google.com/hi.png", + "height": 1080, + "width": 1440, + "orientation": "landscape" + } + }, + "mime": "image/jpeg", + "type": "image", + "subtype": "jpeg", + "id": 2, + "url": "http://google.com/hi.png", + "alt": "title" + } + ] + } + } +] diff --git a/blocks/test/fixtures/core__gallery.parsed.json b/blocks/test/fixtures/core__gallery.parsed.json new file mode 100644 index 00000000000000..914a3635b82bb2 --- /dev/null +++ b/blocks/test/fixtures/core__gallery.parsed.json @@ -0,0 +1,46 @@ +[ + { + "blockName": "core/gallery", + "attrs": { + "images": [ + { + "sizes": { + "full": { + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "height": 1080, + "width": 810, + "orientation": "portrait" + } + }, + "mime": "image/jpeg", + "type": "image", + "subtype": "jpeg", + "id": 1, + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "alt": "title" + }, + { + "sizes": { + "full": { + "url": "http://google.com/hi.png", + "height": 1080, + "width": 1440, + "orientation": "landscape" + } + }, + "mime": "image/jpeg", + "type": "image", + "subtype": "jpeg", + "id": 2, + "url": "http://google.com/hi.png", + "alt": "title" + } + ] + }, + "rawContent": "\n+ ++
+ ++
\n\t\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__gallery.serialized.html b/blocks/test/fixtures/core__gallery.serialized.html new file mode 100644 index 00000000000000..49e8169c9bd47c --- /dev/null +++ b/blocks/test/fixtures/core__gallery.serialized.html @@ -0,0 +1,6 @@ + +\n\t\t \n\t\n\t
\n\t\t \n\n\t
++ \ No newline at end of file diff --git a/blocks/test/fixtures/core-heading-h2-em.html b/blocks/test/fixtures/core__heading__h2-em.html similarity index 100% rename from blocks/test/fixtures/core-heading-h2-em.html rename to blocks/test/fixtures/core__heading__h2-em.html diff --git a/blocks/test/fixtures/core-heading-h2-em.json b/blocks/test/fixtures/core__heading__h2-em.json similarity index 100% rename from blocks/test/fixtures/core-heading-h2-em.json rename to blocks/test/fixtures/core__heading__h2-em.json diff --git a/blocks/test/fixtures/core__heading__h2-em.parsed.json b/blocks/test/fixtures/core__heading__h2-em.parsed.json new file mode 100644 index 00000000000000..3920297cb1ac9c --- /dev/null +++ b/blocks/test/fixtures/core__heading__h2-em.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/heading", + "attrs": null, + "rawContent": "\n+ + The Inserter Tool
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-heading-h2-em.serialized.html b/blocks/test/fixtures/core__heading__h2-em.serialized.html similarity index 100% rename from blocks/test/fixtures/core-heading-h2-em.serialized.html rename to blocks/test/fixtures/core__heading__h2-em.serialized.html diff --git a/blocks/test/fixtures/core-heading-h2.html b/blocks/test/fixtures/core__heading__h2.html similarity index 100% rename from blocks/test/fixtures/core-heading-h2.html rename to blocks/test/fixtures/core__heading__h2.html diff --git a/blocks/test/fixtures/core-heading-h2.json b/blocks/test/fixtures/core__heading__h2.json similarity index 100% rename from blocks/test/fixtures/core-heading-h2.json rename to blocks/test/fixtures/core__heading__h2.json diff --git a/blocks/test/fixtures/core__heading__h2.parsed.json b/blocks/test/fixtures/core__heading__h2.parsed.json new file mode 100644 index 00000000000000..a6d515e0ac0f13 --- /dev/null +++ b/blocks/test/fixtures/core__heading__h2.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/heading", + "attrs": null, + "rawContent": "\nA picture is worth a thousand words, or so the saying goes
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-heading-h2.serialized.html b/blocks/test/fixtures/core__heading__h2.serialized.html similarity index 100% rename from blocks/test/fixtures/core-heading-h2.serialized.html rename to blocks/test/fixtures/core__heading__h2.serialized.html diff --git a/blocks/test/fixtures/core__html.html b/blocks/test/fixtures/core__html.html new file mode 100644 index 00000000000000..4824e6e373c06e --- /dev/null +++ b/blocks/test/fixtures/core__html.html @@ -0,0 +1,4 @@ + +Some HTML code
+ + diff --git a/blocks/test/fixtures/core__html.json b/blocks/test/fixtures/core__html.json new file mode 100644 index 00000000000000..c5f2daf6b551bc --- /dev/null +++ b/blocks/test/fixtures/core__html.json @@ -0,0 +1,9 @@ +[ + { + "uid": "_uid_0", + "name": "core/html", + "attributes": { + "content": "Some HTML code
\n" + } + } +] diff --git a/blocks/test/fixtures/core__html.parsed.json b/blocks/test/fixtures/core__html.parsed.json new file mode 100644 index 00000000000000..ae94db5e9027e1 --- /dev/null +++ b/blocks/test/fixtures/core__html.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/html", + "attrs": null, + "rawContent": "\nSome HTML code
\n\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__html.serialized.html b/blocks/test/fixtures/core__html.serialized.html new file mode 100644 index 00000000000000..4824e6e373c06e --- /dev/null +++ b/blocks/test/fixtures/core__html.serialized.html @@ -0,0 +1,4 @@ + +Some HTML code
+ + diff --git a/blocks/test/fixtures/core__image.html b/blocks/test/fixtures/core__image.html new file mode 100644 index 00000000000000..2a414855b03441 --- /dev/null +++ b/blocks/test/fixtures/core__image.html @@ -0,0 +1,3 @@ + ++ diff --git a/blocks/test/fixtures/core-image.json b/blocks/test/fixtures/core__image.json similarity index 100% rename from blocks/test/fixtures/core-image.json rename to blocks/test/fixtures/core__image.json diff --git a/blocks/test/fixtures/core__image.parsed.json b/blocks/test/fixtures/core__image.parsed.json new file mode 100644 index 00000000000000..e948d85add5d5c --- /dev/null +++ b/blocks/test/fixtures/core__image.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/image", + "attrs": null, + "rawContent": "\n \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__image.serialized.html b/blocks/test/fixtures/core__image.serialized.html new file mode 100644 index 00000000000000..103b9582542792 --- /dev/null +++ b/blocks/test/fixtures/core__image.serialized.html @@ -0,0 +1,4 @@ + + + + diff --git a/blocks/test/fixtures/core__image__center-caption.html b/blocks/test/fixtures/core__image__center-caption.html new file mode 100644 index 00000000000000..293d010b4e5528 --- /dev/null +++ b/blocks/test/fixtures/core__image__center-caption.html @@ -0,0 +1,3 @@ + +
+ diff --git a/blocks/test/fixtures/core-image-center-caption.json b/blocks/test/fixtures/core__image__center-caption.json similarity index 100% rename from blocks/test/fixtures/core-image-center-caption.json rename to blocks/test/fixtures/core__image__center-caption.json diff --git a/blocks/test/fixtures/core__image__center-caption.parsed.json b/blocks/test/fixtures/core__image__center-caption.parsed.json new file mode 100644 index 00000000000000..dbc7b92dd38660 --- /dev/null +++ b/blocks/test/fixtures/core__image__center-caption.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/image", + "attrs": { + "align": "center" + }, + "rawContent": "\n Give it a try. Press the "really wide" button on the image toolbar. \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-image-center-caption.serialized.html b/blocks/test/fixtures/core__image__center-caption.serialized.html similarity index 51% rename from blocks/test/fixtures/core-image-center-caption.serialized.html rename to blocks/test/fixtures/core__image__center-caption.serialized.html index 9b6743d36c62a8..7884d70b3986b5 100644 --- a/blocks/test/fixtures/core-image-center-caption.serialized.html +++ b/blocks/test/fixtures/core__image__center-caption.serialized.html @@ -1,5 +1,5 @@ - - Give it a try. Press the "really wide" button on the image toolbar. + +
diff --git a/blocks/test/fixtures/core__latest-posts.html b/blocks/test/fixtures/core__latest-posts.html new file mode 100644 index 00000000000000..99d215f58affad --- /dev/null +++ b/blocks/test/fixtures/core__latest-posts.html @@ -0,0 +1 @@ + diff --git a/blocks/test/fixtures/core__latest-posts.json b/blocks/test/fixtures/core__latest-posts.json new file mode 100644 index 00000000000000..3f27bca2cbd474 --- /dev/null +++ b/blocks/test/fixtures/core__latest-posts.json @@ -0,0 +1,10 @@ +[ + { + "uid": "_uid_0", + "name": "core/latest-posts", + "attributes": { + "postsToShow": 5, + "displayPostDate": false + } + } +] diff --git a/blocks/test/fixtures/core__latest-posts.parsed.json b/blocks/test/fixtures/core__latest-posts.parsed.json new file mode 100644 index 00000000000000..ac3a8dba1cc674 --- /dev/null +++ b/blocks/test/fixtures/core__latest-posts.parsed.json @@ -0,0 +1,14 @@ +[ + { + "blockName": "core/latest-posts", + "attrs": { + "postsToShow": 5, + "displayPostDate": false + }, + "rawContent": "" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__latest-posts.serialized.html b/blocks/test/fixtures/core__latest-posts.serialized.html new file mode 100644 index 00000000000000..99d215f58affad --- /dev/null +++ b/blocks/test/fixtures/core__latest-posts.serialized.html @@ -0,0 +1 @@ + diff --git a/blocks/test/fixtures/core-list-ul.html b/blocks/test/fixtures/core__list__ul.html similarity index 100% rename from blocks/test/fixtures/core-list-ul.html rename to blocks/test/fixtures/core__list__ul.html diff --git a/blocks/test/fixtures/core-list-ul.json b/blocks/test/fixtures/core__list__ul.json similarity index 100% rename from blocks/test/fixtures/core-list-ul.json rename to blocks/test/fixtures/core__list__ul.json diff --git a/blocks/test/fixtures/core__list__ul.parsed.json b/blocks/test/fixtures/core__list__ul.parsed.json new file mode 100644 index 00000000000000..c29157168e32c7 --- /dev/null +++ b/blocks/test/fixtures/core__list__ul.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/list", + "attrs": null, + "rawContent": "\n ![]()
Give it a try. Press the "really wide" button on the image toolbar. \n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-list-ul.serialized.html b/blocks/test/fixtures/core__list__ul.serialized.html similarity index 100% rename from blocks/test/fixtures/core-list-ul.serialized.html rename to blocks/test/fixtures/core__list__ul.serialized.html diff --git a/blocks/test/fixtures/core__preformatted.html b/blocks/test/fixtures/core__preformatted.html new file mode 100644 index 00000000000000..1a890a7a5dc2d0 --- /dev/null +++ b/blocks/test/fixtures/core__preformatted.html @@ -0,0 +1,3 @@ + +
- 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 :)
Some preformatted text...+ diff --git a/blocks/test/fixtures/core-preformatted.json b/blocks/test/fixtures/core__preformatted.json similarity index 100% rename from blocks/test/fixtures/core-preformatted.json rename to blocks/test/fixtures/core__preformatted.json diff --git a/blocks/test/fixtures/core__preformatted.parsed.json b/blocks/test/fixtures/core__preformatted.parsed.json new file mode 100644 index 00000000000000..b0854646ed594e --- /dev/null +++ b/blocks/test/fixtures/core__preformatted.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/preformatted", + "attrs": null, + "rawContent": "\n
And more!Some preformatted text...\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__preformatted.serialized.html b/blocks/test/fixtures/core__preformatted.serialized.html new file mode 100644 index 00000000000000..ae726c700d0f14 --- /dev/null +++ b/blocks/test/fixtures/core__preformatted.serialized.html @@ -0,0 +1,4 @@ + +
And more!Some preformatted text...+ + diff --git a/blocks/test/fixtures/core-pullquote.html b/blocks/test/fixtures/core__pullquote.html similarity index 77% rename from blocks/test/fixtures/core-pullquote.html rename to blocks/test/fixtures/core__pullquote.html index 027188bce2960d..82b6234073ab9e 100644 --- a/blocks/test/fixtures/core-pullquote.html +++ b/blocks/test/fixtures/core__pullquote.html @@ -1,5 +1,5 @@ -
And more!+diff --git a/blocks/test/fixtures/core-pullquote.json b/blocks/test/fixtures/core__pullquote.json similarity index 100% rename from blocks/test/fixtures/core-pullquote.json rename to blocks/test/fixtures/core__pullquote.json diff --git a/blocks/test/fixtures/core__pullquote.parsed.json b/blocks/test/fixtures/core__pullquote.parsed.json new file mode 100644 index 00000000000000..92a37a6ba57a70 --- /dev/null +++ b/blocks/test/fixtures/core__pullquote.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/pullquote", + "attrs": null, + "rawContent": "\nTesting pullquote block...
\n\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-pullquote.serialized.html b/blocks/test/fixtures/core__pullquote.serialized.html similarity index 74% rename from blocks/test/fixtures/core-pullquote.serialized.html rename to blocks/test/fixtures/core__pullquote.serialized.html index 5a75e75e7bc2cc..e367bc40919cba 100644 --- a/blocks/test/fixtures/core-pullquote.serialized.html +++ b/blocks/test/fixtures/core__pullquote.serialized.html @@ -1,5 +1,5 @@ -Testing pullquote block...
\n+diff --git a/blocks/test/fixtures/core__quote__style-1.html b/blocks/test/fixtures/core__quote__style-1.html new file mode 100644 index 00000000000000..241b2927caead6 --- /dev/null +++ b/blocks/test/fixtures/core__quote__style-1.html @@ -0,0 +1,3 @@ + +Testing pullquote block...
+ diff --git a/blocks/test/fixtures/core__quote__style-1.json b/blocks/test/fixtures/core__quote__style-1.json new file mode 100644 index 00000000000000..dd76ad46a3da74 --- /dev/null +++ b/blocks/test/fixtures/core__quote__style-1.json @@ -0,0 +1,18 @@ +[ + { + "uid": "_uid_0", + "name": "core/quote", + "attributes": { + "style": "1", + "value": [ + { + "children": "The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.", + "type": "p" + } + ], + "citation": [ + "Matt Mullenweg, 2017" + ] + } + } +] diff --git a/blocks/test/fixtures/core__quote__style-1.parsed.json b/blocks/test/fixtures/core__quote__style-1.parsed.json new file mode 100644 index 00000000000000..9af35a7fe4be22 --- /dev/null +++ b/blocks/test/fixtures/core__quote__style-1.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/quote", + "attrs": { + "style": "1" + }, + "rawContent": "\nThe 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.
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-quote-style-1.serialized.html b/blocks/test/fixtures/core__quote__style-1.serialized.html similarity index 77% rename from blocks/test/fixtures/core-quote-style-1.serialized.html rename to blocks/test/fixtures/core__quote__style-1.serialized.html index e38001b88f29a9..0fd5a4efb7117c 100644 --- a/blocks/test/fixtures/core-quote-style-1.serialized.html +++ b/blocks/test/fixtures/core__quote__style-1.serialized.html @@ -1,5 +1,5 @@ - -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.
+ +diff --git a/blocks/test/fixtures/core__quote__style-2.html b/blocks/test/fixtures/core__quote__style-2.html new file mode 100644 index 00000000000000..3c6a113e9bf5be --- /dev/null +++ b/blocks/test/fixtures/core__quote__style-2.html @@ -0,0 +1,3 @@ + +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.
+ diff --git a/blocks/test/fixtures/core-quote-style-2.json b/blocks/test/fixtures/core__quote__style-2.json similarity index 58% rename from blocks/test/fixtures/core-quote-style-2.json rename to blocks/test/fixtures/core__quote__style-2.json index ba3c1bd9241327..114a32462aea3a 100644 --- a/blocks/test/fixtures/core-quote-style-2.json +++ b/blocks/test/fixtures/core__quote__style-2.json @@ -5,9 +5,10 @@ "attributes": { "style": "2", "value": [ - [ - "There is no greater agony than bearing an untold story inside you." - ] + { + "children": "There is no greater agony than bearing an untold story inside you.", + "type": "p" + } ], "citation": [ "Maya Angelou" diff --git a/blocks/test/fixtures/core__quote__style-2.parsed.json b/blocks/test/fixtures/core__quote__style-2.parsed.json new file mode 100644 index 00000000000000..5988b9863e722b --- /dev/null +++ b/blocks/test/fixtures/core__quote__style-2.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/quote", + "attrs": { + "style": "2" + }, + "rawContent": "\nThere is no greater agony than bearing an untold story inside you.
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-quote-style-2.serialized.html b/blocks/test/fixtures/core__quote__style-2.serialized.html similarity index 61% rename from blocks/test/fixtures/core-quote-style-2.serialized.html rename to blocks/test/fixtures/core__quote__style-2.serialized.html index 6d5b9988eb347c..ae59dce584a223 100644 --- a/blocks/test/fixtures/core-quote-style-2.serialized.html +++ b/blocks/test/fixtures/core__quote__style-2.serialized.html @@ -1,5 +1,5 @@ - -There is no greater agony than bearing an untold story inside you.
+ +diff --git a/blocks/test/fixtures/core-separator.html b/blocks/test/fixtures/core__separator.html similarity index 61% rename from blocks/test/fixtures/core-separator.html rename to blocks/test/fixtures/core__separator.html index a241e07204f9aa..d835a483147f13 100644 --- a/blocks/test/fixtures/core-separator.html +++ b/blocks/test/fixtures/core__separator.html @@ -1,3 +1,3 @@ -There is no greater agony than bearing an untold story inside you.
+
diff --git a/blocks/test/fixtures/core-separator.json b/blocks/test/fixtures/core__separator.json similarity index 100% rename from blocks/test/fixtures/core-separator.json rename to blocks/test/fixtures/core__separator.json diff --git a/blocks/test/fixtures/core__separator.parsed.json b/blocks/test/fixtures/core__separator.parsed.json new file mode 100644 index 00000000000000..9dbc62b9dbd849 --- /dev/null +++ b/blocks/test/fixtures/core__separator.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/separator", + "attrs": null, + "rawContent": "\n
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-separator.serialized.html b/blocks/test/fixtures/core__separator.serialized.html similarity index 62% rename from blocks/test/fixtures/core-separator.serialized.html rename to blocks/test/fixtures/core__separator.serialized.html index a4115292004428..0cc337d26dc88c 100644 --- a/blocks/test/fixtures/core-separator.serialized.html +++ b/blocks/test/fixtures/core__separator.serialized.html @@ -1,4 +1,4 @@ -
+
diff --git a/blocks/test/fixtures/core-table.html b/blocks/test/fixtures/core__table.html similarity index 98% rename from blocks/test/fixtures/core-table.html rename to blocks/test/fixtures/core__table.html index 60008a1566ef04..de0498f605be4d 100644 --- a/blocks/test/fixtures/core-table.html +++ b/blocks/test/fixtures/core__table.html @@ -1,5 +1,5 @@ -+
Version diff --git a/blocks/test/fixtures/core-table.json b/blocks/test/fixtures/core__table.json similarity index 100% rename from blocks/test/fixtures/core-table.json rename to blocks/test/fixtures/core__table.json diff --git a/blocks/test/fixtures/core__table.parsed.json b/blocks/test/fixtures/core__table.parsed.json new file mode 100644 index 00000000000000..714f17be0caa70 --- /dev/null +++ b/blocks/test/fixtures/core__table.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/table", + "attrs": null, + "rawContent": "\n\n \n
\n" + }, + { + "attrs": {}, + "rawContent": "\n\n" + } +] diff --git a/blocks/test/fixtures/core-table.serialized.html b/blocks/test/fixtures/core__table.serialized.html similarity index 98% rename from blocks/test/fixtures/core-table.serialized.html rename to blocks/test/fixtures/core__table.serialized.html index 174adfec5ae84d..40d9109b062719 100644 --- a/blocks/test/fixtures/core-table.serialized.html +++ b/blocks/test/fixtures/core__table.serialized.html @@ -1,5 +1,5 @@ -\n \n \n \nVersion \nMusician \nDate \n\n \n.70 \nNo musician chosen. \nMay 27, 2003 \n\n \n1.0 \nMiles Davis \nJanuary 3, 2004 \n\n \nLots of versions skipped, see the full list \n… \n… \n\n \n4.4 \nClifford Brown \nDecember 8, 2015 \n\n \n4.5 \nColeman Hawkins \nApril 12, 2016 \n\n \n4.6 \nPepper Adams \nAugust 16, 2016 \n\n \n \n4.7 \nSarah Vaughan \nDecember 6, 2016 \n+
Version diff --git a/blocks/test/fixtures/core-text-align-right.html b/blocks/test/fixtures/core__text__align-right.html similarity index 76% rename from blocks/test/fixtures/core-text-align-right.html rename to blocks/test/fixtures/core__text__align-right.html index d3d0c922ce2bff..65a819fd91c6f2 100644 --- a/blocks/test/fixtures/core-text-align-right.html +++ b/blocks/test/fixtures/core__text__align-right.html @@ -1,3 +1,3 @@ - +... like this one, which is separate from the above and right aligned.
diff --git a/blocks/test/fixtures/core-text-align-right.json b/blocks/test/fixtures/core__text__align-right.json similarity index 100% rename from blocks/test/fixtures/core-text-align-right.json rename to blocks/test/fixtures/core__text__align-right.json diff --git a/blocks/test/fixtures/core__text__align-right.parsed.json b/blocks/test/fixtures/core__text__align-right.parsed.json new file mode 100644 index 00000000000000..b4c6287f3514c0 --- /dev/null +++ b/blocks/test/fixtures/core__text__align-right.parsed.json @@ -0,0 +1,13 @@ +[ + { + "blockName": "core/text", + "attrs": { + "align": "right" + }, + "rawContent": "\n... like this one, which is separate from the above and right aligned.
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core-text-align-right.serialized.html b/blocks/test/fixtures/core__text__align-right.serialized.html similarity index 76% rename from blocks/test/fixtures/core-text-align-right.serialized.html rename to blocks/test/fixtures/core__text__align-right.serialized.html index 5bbeb051d31867..3a56f80bd3c546 100644 --- a/blocks/test/fixtures/core-text-align-right.serialized.html +++ b/blocks/test/fixtures/core__text__align-right.serialized.html @@ -1,4 +1,4 @@ - +... like this one, which is separate from the above and right aligned.
diff --git a/blocks/test/full-content.js b/blocks/test/full-content.js index 7a16290ddb872e..b98e1644d23b84 100644 --- a/blocks/test/full-content.js +++ b/blocks/test/full-content.js @@ -11,15 +11,17 @@ import { format } from 'util'; * Internal dependencies */ import parse from '../api/parser'; +import { parse as grammarParse } from '../api/post.pegjs'; import serialize from '../api/serializer'; import { getBlockTypes } from '../api/registration'; const fixturesDir = path.join( __dirname, 'fixtures' ); -// We expect 3 different types of files for each fixture: -// - fixture.html - original content -// - fixture.json - blocks structure -// - fixture.serialized.html - re-serialized content +// We expect 4 different types of files for each fixture: +// - fixture.html : original content +// - fixture.parsed.json : parser output +// - fixture.json : blocks structure +// - fixture.serialized.html : re-serialized content // Get the "base" name for each fixture first. const fileBasenames = uniq( fs.readdirSync( fixturesDir ) @@ -53,7 +55,7 @@ function normalizeReactTree( element ) { // Check if we got an object first, then if it actually has a `type` like a // React component. Sometimes we get other stuff here, which probably // indicates a bug. - if ( isObject( element ) && element.type ) { + if ( isObject( element ) && element.type && element.props ) { const toReturn = { type: element.type, }; @@ -91,6 +93,27 @@ describe( 'full post content fixture', () => { it( f, () => { const content = readFixtureFile( f + '.html' ); + const parserOutputActual = grammarParse( content ); + let parserOutputExpectedString = readFixtureFile( f + '.parsed.json' ); + + if ( ! parserOutputExpectedString ) { + if ( process.env.GENERATE_MISSING_FIXTURES ) { + parserOutputExpectedString = JSON.stringify( + parserOutputActual, + null, + 4 + ) + '\n'; + writeFixtureFile( f + '.parsed.json', parserOutputExpectedString ); + } else { + throw new Error( + 'Missing fixture file: ' + f + '.parsed.json' + ); + } + } + + const parserOutputExpected = JSON.parse( parserOutputExpectedString ); + expect( parserOutputActual ).to.eql( parserOutputExpected ); + const blocksActual = parse( content ); const blocksActualNormalized = normalizeParsedBlocks( blocksActual ); let blocksExpectedString = readFixtureFile( f + '.json' ); @@ -135,11 +158,11 @@ describe( 'full post content fixture', () => { const errors = []; getBlockTypes().map( block => block.name ).forEach( name => { - const nameToFilename = name.replace( /\//g, '-' ); + const nameToFilename = name.replace( /\//g, '__' ); const foundFixtures = fileBasenames .filter( basename => ( basename === nameToFilename || - startsWith( basename, nameToFilename + '-' ) + startsWith( basename, nameToFilename + '__' ) ) ) .map( basename => { const filename = basename + '.html'; @@ -152,7 +175,7 @@ describe( 'full post content fixture', () => { if ( ! foundFixtures.length ) { errors.push( format( - 'Expected a fixture file called \'%s.html\' or \'%s-*.html\'.', + 'Expected a fixture file called \'%s.html\' or \'%s__*.html\'.', nameToFilename, nameToFilename ) ); diff --git a/bootstrap-test.js b/bootstrap-test.js index e50256f2b0b82c..a29de5fc8b947f 100644 --- a/bootstrap-test.js +++ b/bootstrap-test.js @@ -60,3 +60,7 @@ global.window._wpDateSettings = { string: 'America/New_York', }, }; +global.wp = global.wp || {}; +global.wp.a11y = { + speak: () => {}, +}; diff --git a/components/button/index.js b/components/button/index.js index 87a8964150d947..e13ec43759c5a9 100644 --- a/components/button/index.js +++ b/components/button/index.js @@ -7,7 +7,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component, createElement } from 'element'; class Button extends Component { constructor( props ) { @@ -39,7 +39,7 @@ class Button extends Component { delete additionalProps.focus; - return wp.element.createElement( tag, { + return createElement( tag, { ...tagProps, ...additionalProps, className: classes, diff --git a/components/dashicon/index.js b/components/dashicon/index.js index 4d57249d0950b3..0e7328fbbfbfa5 100644 --- a/components/dashicon/index.js +++ b/components/dashicon/index.js @@ -63,8 +63,17 @@ export default class Dashicon extends wp.element.Component { case 'admin-settings': path = 'M18 16V4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h13c.55 0 1-.45 1-1zM8 11h1c.55 0 1 .45 1 1s-.45 1-1 1H8v1.5c0 .28-.22.5-.5.5s-.5-.22-.5-.5V13H6c-.55 0-1-.45-1-1s.45-1 1-1h1V5.5c0-.28.22-.5.5-.5s.5.22.5.5V11zm5-2h-1c-.55 0-1-.45-1-1s.45-1 1-1h1V5.5c0-.28.22-.5.5-.5s.5.22.5.5V7h1c.55 0 1 .45 1 1s-.45 1-1 1h-1v5.5c0 .28-.22.5-.5.5s-.5-.22-.5-.5V9z'; break; + case 'admin-site-alt': + path = 'M10 1a9 9 0 1 0 9 9 9 9 0 0 0-9-9zm7.5 6.48a3.38 3.38 0 0 1-1.75 2.05 5.64 5.64 0 0 0-3.27-3.75 2 2 0 0 1 .79-1.09c-.43-.28-1-.42-1.34.07-.53.69 0 1.61.21 2v.14a3.07 3.07 0 0 1-1.24-1.44 5.2 5.2 0 0 0-2.76.69 3.44 3.44 0 0 1 .16-1.68 2.21 2.21 0 0 0 1.92-.8c.46-.52-.13-1.18-.59-1.58h.36a7.86 7.86 0 0 1 3.89 1 5.61 5.61 0 0 1 2.27 4.26c.24 0 .7-.55.91-.92a7.86 7.86 0 0 1 .44 1.05zM10 17.84c-2.05-2.08.25-3.75-1-5.24-.92-.85-2.29-.26-3.11-1.23a4.08 4.08 0 0 1 1.43-3.93c.52-.44 4-1 5.42.22a5.22 5.22 0 0 1 1.67 2.74 2.35 2.35 0 0 0 1.32-.29c.41 2.98-3.15 6.74-5.73 7.73zM6.15 3.09a1.84 1.84 0 0 1 2.16.66 2.92 2.92 0 0 1-1.5.72A3 3 0 0 1 7 3.61z'; + break; + case 'admin-site-alt2': + path = 'M10 1a9 9 0 1 0 9 9 9 9 0 0 0-9-9zm2.92 12.34c0 .35.14.63.36.66s.47-.22.58-.6l.2.08a1.72 1.72 0 0 1 .84 2 1.58 1.58 0 0 1-1.45 1.24c-.49-1.21-2.11.06-3.56-.22a1.92 1.92 0 0 1-1.33-1.19c1.19-.11 2.85-1.73 4.36-1.97zM9 12.27a1.84 1.84 0 0 0 1.82-1.59 1.39 1.39 0 0 1-.07 1.83A1.17 1.17 0 0 1 9 12.27zm3-.76c.41.39 3-.06 3.52 1.09-.95-.2-2.95.61-3.47-1.08zm-1.27-5.06v.27c-.65-.77-1.33-1.07-1.61-.57s1 1.11.76 1.88S8.61 8.59 8 9.64s-.49 2.42 1.24 3.67A3 3 0 0 1 6.7 11.2c-.4-1.2-.09-2.26-.78-2.46C5 8.46 4 9.71 4 10.8c-1.26-1.26.05-2.86-1.2-4.18a7.89 7.89 0 0 1 9.64-4.13 5.34 5.34 0 0 0-1.71 3.96z'; + break; + case 'admin-site-alt3': + path = 'M10 1a9 9 0 1 0 9 9 9 9 0 0 0-9-9zm-7.89 9.68h2.51a14.13 14.13 0 0 0 .38 2.7H2.84a7.86 7.86 0 0 1-.73-2.7zm8.57-5.4V2.19a4.13 4.13 0 0 1 2.22 2 8.53 8.53 0 0 1 .54 1.08zm3.22 1.35a12.88 12.88 0 0 1 .41 2.7h-3.63v-2.7zM9.32 2.19v3.09H6.56A8.53 8.53 0 0 1 7.1 4.2a4.13 4.13 0 0 1 2.22-2.01zm0 4.44v2.7H5.7a12.88 12.88 0 0 1 .41-2.7zm-4.7 2.69H2.11a7.86 7.86 0 0 1 .73-2.7H5a14.13 14.13 0 0 0-.38 2.7zm1.08 1.36h3.62v2.7H6.11a12.88 12.88 0 0 1-.41-2.7zm3.63 4v3.09a4.13 4.13 0 0 1-2.22-2 8.53 8.53 0 0 1-.54-1.08zm1.35 3.09v-3.04h2.76a8.53 8.53 0 0 1-.54 1.08 4.13 4.13 0 0 1-2.22 2zm0-4.44v-2.7h3.62a12.88 12.88 0 0 1-.41 2.7zm4.71-2.7h2.51a7.86 7.86 0 0 1-.73 2.7H15a14.13 14.13 0 0 0 .38-2.65zm0-1.35A14.13 14.13 0 0 0 15 6.63h2.16a7.86 7.86 0 0 1 .73 2.7zm1-4H14.6a8.92 8.92 0 0 0-1.39-2.52 8 8 0 0 1 3.14 2.52zm-9.6-2.52A8.92 8.92 0 0 0 5.4 5.28H3.65a8 8 0 0 1 3.14-2.52zm-3.15 12H5.4a8.92 8.92 0 0 0 1.39 2.52 8 8 0 0 1-3.14-2.55zm9.56 2.52a8.92 8.92 0 0 0 1.39-2.52h1.76a8 8 0 0 1-3.14 2.48z'; + break; case 'admin-site': - path = 'M19 10c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9 9-4.03 9-9zm-11 .1c-2.84-.29-4.48-1.17-5.48-2.29.97-3.16 3.8-5.48 7.25-5.63-.84 1.38-1.5 4.13-.03 5.57-1.51.21-2.21-1.86-3.11-1.15-1.43 1.12-.08 2.67 3.2 3.27 3.29.59 3.66 1.58 3.63 3.08-.03 1.47-.8 3.3-4.06 4.7.09-4.18-2.64-3.84-3.2-5.04.2-.87.44-1.78 1.8-2.51zm8.49-4.32c2.15 3.3 1.02 6.08.84 6.68-.77-1.86-2.17-2.29-2.53-3.54-.32-1.11.62-2.23 1.69-3.14z'; + path = 'M10 1a9 9 0 1 0 9 9 9 9 0 0 0-9-9zm3.46 11.95c0 1.47-.8 3.3-4.06 4.7.3-4.17-2.52-3.69-3.2-5A3.25 3.25 0 0 1 8 10.1a8.49 8.49 0 0 1-4.18-2 1.84 1.84 0 0 0 .64 1.21 4.18 4.18 0 0 1-1.94-1.5 7.94 7.94 0 0 1 7.25-5.63c-.84 1.38-1.5 4.13 0 5.57C8.23 8 7.26 6 6.41 6.79c-1.13 1.06.33 2.51 3.42 3.08 3.29.59 3.66 1.58 3.63 3.08zm1.34-4c-.32-1.11.62-2.23 1.69-3.14a7.27 7.27 0 0 1 .84 6.68c-.77-1.89-2.17-2.32-2.53-3.57z'; break; case 'admin-tools': path = 'M16.68 9.77c-1.34 1.34-3.3 1.67-4.95.99l-5.41 6.52c-.99.99-2.59.99-3.58 0s-.99-2.59 0-3.57l6.52-5.42c-.68-1.65-.35-3.61.99-4.95 1.28-1.28 3.12-1.62 4.72-1.06l-2.89 2.89 2.82 2.82 2.86-2.87c.53 1.58.18 3.39-1.08 4.65zM3.81 16.21c.4.39 1.04.39 1.43 0 .4-.4.4-1.04 0-1.43-.39-.4-1.03-.4-1.43 0-.39.39-.39 1.03 0 1.43z'; @@ -150,6 +159,39 @@ export default class Dashicon extends wp.element.Component { case 'book': path = 'M16 3h2v16H5c-1.66 0-3-1.34-3-3V4c0-1.66 1.34-3 3-3h9v14H5c-.55 0-1 .45-1 1s.45 1 1 1h11V3z'; break; + case 'buddicons-activity': + path = 'M8 1v7h2V6c0-1.52 1.45-3 3-3v.86c.55-.52 1.26-.86 2-.86v3h1c1.1 0 2 .9 2 2s-.9 2-2 2h-1v6c0 .55-.45 1-1 1s-1-.45-1-1v-2.18c-.31.11-.65.18-1 .18v2c0 .55-.45 1-1 1s-1-.45-1-1v-2H8v2c0 .55-.45 1-1 1s-1-.45-1-1v-2c-.35 0-.69-.07-1-.18V16c0 .55-.45 1-1 1s-1-.45-1-1v-4H2v-1c0-1.66 1.34-3 3-3h2V1h1zm5 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1z'; + break; + case 'buddicons-buddypress-logo': + path = 'M10 0c5.52 0 10 4.48 10 10s-4.48 10-10 10S0 15.52 0 10 4.48 0 10 0zm0 .5C4.75.5.5 4.75.5 10s4.25 9.5 9.5 9.5 9.5-4.25 9.5-9.5S15.25.5 10 .5zm0 1c4.7 0 8.5 3.8 8.5 8.5s-3.8 8.5-8.5 8.5-8.5-3.8-8.5-8.5S5.3 1.5 10 1.5zm1.8 1.71c-.57 0-1.1.17-1.55.45 1.56.37 2.73 1.77 2.73 3.45 0 .69-.21 1.33-.55 1.87 1.31-.29 2.29-1.45 2.29-2.85 0-1.61-1.31-2.92-2.92-2.92zm-2.38 1c-1.61 0-2.92 1.31-2.92 2.93 0 1.61 1.31 2.92 2.92 2.92 1.62 0 2.93-1.31 2.93-2.92 0-1.62-1.31-2.93-2.93-2.93zm4.25 5.01l-.51.59c2.34.69 2.45 3.61 2.45 3.61h1.28c0-4.71-3.22-4.2-3.22-4.2zm-2.1.8l-2.12 2.09-2.12-2.09C3.12 10.24 3.89 15 3.89 15h11.08c.47-4.98-3.4-4.98-3.4-4.98z'; + break; + case 'buddicons-community': + path = 'M9 3c0-.67-.47-1.43-1-2-.5.5-1 1.38-1 2 0 .48.45 1 1 1s1-.47 1-1zm4 0c0-.67-.47-1.43-1-2-.5.5-1 1.38-1 2 0 .48.45 1 1 1s1-.47 1-1zM9 9V5.5c0-.55-.45-1-1-1-.57 0-1 .49-1 1V9c0 .55.45 1 1 1 .57 0 1-.49 1-1zm4 0V5.5c0-.55-.45-1-1-1-.57 0-1 .49-1 1V9c0 .55.45 1 1 1 .57 0 1-.49 1-1zm4 1c0-1.48-1.41-2.77-3.5-3.46V9c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5V6.01c-.17 0-.33-.01-.5-.01s-.33.01-.5.01V9c0 .83-.67 1.5-1.5 1.5S6.5 9.83 6.5 9V6.54C4.41 7.23 3 8.52 3 10c0 1.41.95 2.65 3.21 3.37 1.11.35 2.39 1.12 3.79 1.12s2.69-.78 3.79-1.13C16.04 12.65 17 11.41 17 10zm-7 5.43c1.43 0 2.74-.79 3.88-1.11 1.9-.53 2.49-1.34 3.12-2.32v3c0 2.21-3.13 4-7 4s-7-1.79-7-4v-3c.64.99 1.32 1.8 3.15 2.33 1.13.33 2.44 1.1 3.85 1.1z'; + break; + case 'buddicons-forums': + path = 'M13.5 7h-7C5.67 7 5 6.33 5 5.5S5.67 4 6.5 4h1.59C8.04 3.84 8 3.68 8 3.5 8 2.67 8.67 2 9.5 2h1c.83 0 1.5.67 1.5 1.5 0 .18-.04.34-.09.5h1.59c.83 0 1.5.67 1.5 1.5S14.33 7 13.5 7zM4 8h12c.55 0 1 .45 1 1s-.45 1-1 1H4c-.55 0-1-.45-1-1s.45-1 1-1zm1 3h10c.55 0 1 .45 1 1s-.45 1-1 1H5c-.55 0-1-.45-1-1s.45-1 1-1zm2 3h6c.55 0 1 .45 1 1s-.45 1-1 1h-1.09c.05.16.09.32.09.5 0 .83-.67 1.5-1.5 1.5h-1c-.83 0-1.5-.67-1.5-1.5 0-.18.04-.34.09-.5H7c-.55 0-1-.45-1-1s.45-1 1-1z'; + break; + case 'buddicons-friends': + path = 'M8.75 5.77C8.75 4.39 7 2 7 2S5.25 4.39 5.25 5.77 5.9 7.5 7 7.5s1.75-.35 1.75-1.73zm6 0C14.75 4.39 13 2 13 2s-1.75 2.39-1.75 3.77S11.9 7.5 13 7.5s1.75-.35 1.75-1.73zM9 17V9c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1h2c.55 0 1-.45 1-1zm6 0V9c0-.55-.45-1-1-1h-2c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1h2c.55 0 1-.45 1-1zm-9-6l2-1v2l-2 1v-2zm6 0l2-1v2l-2 1v-2zm-6 3l2-1v2l-2 1v-2zm6 0l2-1v2l-2 1v-2z'; + break; + case 'buddicons-groups': + path = 'M15.45 6.25c1.83.94 1.98 3.18.7 4.98-.8 1.12-2.33 1.88-3.46 1.78L10.05 18H9l-2.65-4.99c-1.13.16-2.73-.63-3.55-1.79-1.28-1.8-1.13-4.04.71-4.97.48-.24.96-.33 1.43-.31-.01.4.01.8.07 1.21.26 1.69 1.41 3.53 2.86 4.37-.19.55-.49.99-.88 1.25L9 16.58v-5.66C7.64 10.55 6.26 8.76 6 7c-.4-2.65 1-5 3.5-5s3.9 2.35 3.5 5c-.26 1.76-1.64 3.55-3 3.92v5.77l2.07-3.84c-.44-.23-.77-.71-.99-1.3 1.48-.83 2.65-2.69 2.91-4.4.06-.41.08-.82.07-1.22.46-.01.92.08 1.39.32z'; + break; + case 'buddicons-pm': + path = 'M10 2c3 0 8 5 8 5v11H2V7s5-5 8-5zm7 14.72l-3.73-2.92L17 11l-.43-.37-2.26 1.3.24-4.31-8.77-.52-.46 4.54-1.99-.95L3 11l3.73 2.8-3.44 2.85.4.43L10 13l6.53 4.15z'; + break; + case 'buddicons-replies': + path = 'M17.54 10.29c1.17 1.17 1.17 3.08 0 4.25-1.18 1.17-3.08 1.17-4.25 0l-.34-.52c0 3.66-2 4.38-2.95 4.98-.82-.6-2.95-1.28-2.95-4.98l-.34.52c-1.17 1.17-3.07 1.17-4.25 0-1.17-1.17-1.17-3.08 0-4.25 0 0 1.02-.67 2.1-1.3C3.71 7.84 3.2 6.42 3.2 4.88c0-.34.03-.67.08-1C3.53 5.66 4.47 7.22 5.8 8.3c.67-.35 1.85-.83 2.37-.92H8c-1.1 0-2-.9-2-2s.9-2 2-2v-.5c0-.28.22-.5.5-.5s.5.22.5.5v.5h2v-.5c0-.28.22-.5.5-.5s.5.22.5.5v.5c1.1 0 2 .9 2 2s-.9 2-2 2h-.17c.51.09 1.78.61 2.38.92 1.33-1.08 2.27-2.64 2.52-4.42.05.33.08.66.08 1 0 1.54-.51 2.96-1.36 4.11 1.08.63 2.09 1.3 2.09 1.3zM8.5 6.38c.5 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm3-2c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-2.3 5.73c-.12.11-.19.26-.19.43.02.25.23.46.49.46h1c.26 0 .47-.21.49-.46 0-.15-.07-.29-.19-.43-.08-.06-.18-.11-.3-.11h-1c-.12 0-.22.05-.3.11zM12 12.5c0-.12-.06-.28-.19-.38-.09-.07-.19-.12-.31-.12h-3c-.12 0-.22.05-.31.12-.11.1-.19.25-.19.38 0 .28.22.5.5.5h3c.28 0 .5-.22.5-.5zM8.5 15h3c.28 0 .5-.22.5-.5s-.22-.5-.5-.5h-3c-.28 0-.5.22-.5.5s.22.5.5.5zm1 2h1c.28 0 .5-.22.5-.5s-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5z'; + break; + case 'buddicons-topics': + path = 'M10.44 1.66c-.59-.58-1.54-.58-2.12 0L2.66 7.32c-.58.58-.58 1.53 0 2.12.6.6 1.56.56 2.12 0l5.66-5.66c.58-.58.59-1.53 0-2.12zm2.83 2.83c-.59-.59-1.54-.59-2.12 0l-5.66 5.66c-.59.58-.59 1.53 0 2.12.6.6 1.56.55 2.12 0l5.66-5.66c.58-.58.58-1.53 0-2.12zm1.06 6.72l4.18 4.18c.59.58.59 1.53 0 2.12s-1.54.59-2.12 0l-4.18-4.18-1.77 1.77c-.59.58-1.54.58-2.12 0-.59-.59-.59-1.54 0-2.13l5.66-5.65c.58-.59 1.53-.59 2.12 0 .58.58.58 1.53 0 2.12zM5 15c0-1.59-1.66-4-1.66-4S2 13.78 2 15s.6 2 1.34 2h.32C4.4 17 5 16.59 5 15z'; + break; + case 'buddicons-tracking': + path = 'M10.98 6.78L15.5 15c-1 2-3.5 3-5.5 3s-4.5-1-5.5-3L9 6.82c-.75-1.23-2.28-1.98-4.29-2.03l2.46-2.92c1.68 1.19 2.46 2.32 2.97 3.31.56-.87 1.2-1.68 2.7-2.12l1.83 2.86c-1.42-.34-2.64.08-3.69.86zM8.17 10.4l-.93 1.69c.49.11 1 .16 1.54.16 1.35 0 2.58-.36 3.55-.95l-1.01-1.82c-.87.53-1.96.86-3.15.92zm.86 5.38c1.99 0 3.73-.74 4.74-1.86l-.98-1.76c-1 1.12-2.74 1.87-4.74 1.87-.62 0-1.21-.08-1.76-.21l-.63 1.15c.94.5 2.1.81 3.37.81z'; + break; + case 'buddipress-bbpress-logo': + path = 'M8.5 12.6c.3-1.3 0-2.3-1.1-2.3-.8 0-1.6.6-1.8 1.5l-.3 1.7c-.3 1 .3 1.5 1 1.5 1.2 0 1.9-1.1 2.2-2.4zm-4-6.4C3.7 7.3 3.3 8.6 3.3 10c0 1 .2 1.9.6 2.8l1-4.6c.3-1.7.4-2-.4-2zm9.3 6.4c.3-1.3 0-2.3-1.1-2.3-.8 0-1.6.6-1.8 1.5l-.4 1.7c-.2 1.1.4 1.6 1.1 1.6 1.1-.1 1.9-1.2 2.2-2.5zM10 3.3c-2 0-3.9.9-5.1 2.3.6-.1 1.4-.2 1.8-.3.2 0 .2.1.2.2 0 .2-1 4.8-1 4.8.5-.3 1.2-.7 1.8-.7.9 0 1.5.4 1.9.9l.5-2.4c.4-1.6.4-1.9-.4-1.9-.4 0-.4-.5 0-.6.6-.1 1.8-.2 2.3-.3.2 0 .2.1.2.2l-1 4.8c.5-.4 1.2-.7 1.9-.7 1.7 0 2.5 1.3 2.1 3-.3 1.7-2 3-3.8 3-1.3 0-2.1-.7-2.3-1.4-.7.8-1.7 1.3-2.8 1.4 1.1.7 2.4 1.1 3.7 1.1 3.7 0 6.7-3 6.7-6.7s-3-6.7-6.7-6.7zM10 2c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 15.5c-2.1 0-4-.8-5.3-2.2-.3-.4-.7-.8-1-1.2-.7-1.2-1.2-2.6-1.2-4.1 0-4.1 3.4-7.5 7.5-7.5s7.5 3.4 7.5 7.5-3.4 7.5-7.5 7.5z'; + break; case 'building': path = 'M3 20h14V0H3v20zM7 3H5V1h2v2zm4 0H9V1h2v2zm4 0h-2V1h2v2zM7 6H5V4h2v2zm4 0H9V4h2v2zm4 0h-2V4h2v2zM7 9H5V7h2v2zm4 0H9V7h2v2zm4 0h-2V7h2v2zm-8 3H5v-2h2v2zm4 0H9v-2h2v2zm4 0h-2v-2h2v2zm-4 7H5v-6h6v6zm4-4h-2v-2h2v2zm0 3h-2v-2h2v2z'; break; @@ -345,7 +387,7 @@ export default class Dashicon extends wp.element.Component { case 'email': path = 'M3.87 4h13.25C18.37 4 19 4.59 19 5.79v8.42c0 1.19-.63 1.79-1.88 1.79H3.87c-1.25 0-1.88-.6-1.88-1.79V5.79c0-1.2.63-1.79 1.88-1.79zm6.62 8.6l6.74-5.53c.24-.2.43-.66.13-1.07-.29-.41-.82-.42-1.17-.17l-5.7 3.86L4.8 5.83c-.35-.25-.88-.24-1.17.17-.3.41-.11.87.13 1.07z'; break; - case 'exerpt-view': + case 'excerpt-view': path = 'M19 18V2c0-.55-.45-1-1-1H2c-.55 0-1 .45-1 1v16c0 .55.45 1 1 1h16c.55 0 1-.45 1-1zM4 3c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm13 0v6H6V3h11zM4 11c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm13 0v6H6v-6h11z'; break; case 'external': @@ -414,6 +456,9 @@ export default class Dashicon extends wp.element.Component { case 'hidden': path = 'M17.2 3.3l.16.17c.39.39.39 1.02 0 1.41L4.55 17.7c-.39.39-1.03.39-1.41 0l-.17-.17c-.39-.39-.39-1.02 0-1.41l1.59-1.6c-1.57-1-2.76-2.3-3.56-3.93.81-1.65 2.03-2.98 3.64-3.99S8.04 5.09 10 5.09c1.2 0 2.33.21 3.4.6l2.38-2.39c.39-.39 1.03-.39 1.42 0zm-7.09 4.01c-.23.25-.34.54-.34.88 0 .31.12.58.31.81l1.8-1.79c-.13-.12-.28-.21-.45-.26-.11-.01-.28-.03-.49-.04-.33.03-.6.16-.83.4zM2.4 10.59c.69 1.23 1.71 2.25 3.05 3.05l1.28-1.28c-.51-.69-.77-1.47-.77-2.36 0-1.06.36-1.98 1.09-2.76-1.04.27-1.96.7-2.76 1.26-.8.58-1.43 1.27-1.89 2.09zm13.22-2.13l.96-.96c1.02.86 1.83 1.89 2.42 3.09-.81 1.65-2.03 2.98-3.64 3.99s-3.4 1.51-5.36 1.51c-.63 0-1.24-.07-1.83-.18l1.07-1.07c.25.02.5.05.76.05 1.63 0 3.13-.4 4.5-1.21s2.4-1.84 3.1-3.09c-.46-.82-1.09-1.51-1.89-2.09-.03-.01-.06-.03-.09-.04zm-5.58 5.58l4-4c-.01 1.1-.41 2.04-1.18 2.81-.78.78-1.72 1.18-2.82 1.19z'; break; + case 'html': + path = 'M4 16v-2H2v2H1v-5h1v2h2v-2h1v5H4zM7 16v-4H5.6v-1h3.7v1H8v4H7zM10 16v-5h1l1.4 3.4h.1L14 11h1v5h-1v-3.1h-.1l-1.1 2.5h-.6l-1.1-2.5H11V16h-1zM19 16h-3v-5h1v4h2v1zM9.4 4.2L7.1 6.5l2.3 2.3-.6 1.2-3.5-3.5L8.8 3l.6 1.2zm1.2 4.6l2.3-2.3-2.3-2.3.6-1.2 3.5 3.5-3.5 3.5-.6-1.2z'; + break; case 'id-alt': path = 'M18 18H2V2h16v16zM8.05 7.53c.13-.07.24-.15.33-.24.09-.1.17-.21.24-.34.07-.14.13-.26.17-.37s.07-.22.1-.34L8.95 6c0-.04.01-.07.01-.09.05-.32.03-.61-.04-.9-.08-.28-.23-.52-.46-.72C8.23 4.1 7.95 4 7.6 4c-.2 0-.39.04-.56.11-.17.08-.31.18-.41.3-.11.13-.2.27-.27.44-.07.16-.11.33-.12.51s0 .36.01.55l.02.09c.01.06.03.15.06.25s.06.21.1.33.1.25.17.37c.08.12.16.23.25.33s.2.19.34.25c.13.06.28.09.43.09s.3-.03.43-.09zM16 5V4h-5v1h5zm0 2V6h-5v1h5zM7.62 8.83l-1.38-.88c-.41 0-.79.11-1.14.32-.35.22-.62.5-.81.85-.19.34-.29.7-.29 1.07v1.25l.2.05c.13.04.31.09.55.14.24.06.51.12.8.17.29.06.62.1 1 .14.37.04.73.06 1.07.06s.69-.02 1.07-.06.7-.09.98-.14c.27-.05.54-.1.82-.17.27-.06.45-.11.54-.13.09-.03.16-.05.21-.06v-1.25c0-.36-.1-.72-.31-1.07s-.49-.64-.84-.86-.72-.33-1.11-.33zM16 9V8h-3v1h3zm0 2v-1h-3v1h3zm0 3v-1H4v1h12zm0 2v-1H4v1h12z'; break; @@ -682,7 +727,7 @@ export default class Dashicon extends wp.element.Component { path = 'M11 7H9.49c-.63 0-1.25.3-1.59.7L7 5H4.13l-2.39 7h1.69l.74-2H7v4H2c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h7c1.1 0 2 .9 2 2v2zM6.51 9H4.49l1-2.93zM10 8h7c1.1 0 2 .9 2 2v7c0 1.1-.9 2-2 2h-7c-1.1 0-2-.9-2-2v-7c0-1.1.9-2 2-2zm7.25 5v-1.08h-3.17V9.75h-1.16v2.17H9.75V13h1.28c.11.85.56 1.85 1.28 2.62-.87.36-1.89.62-2.31.62-.01.02.22.97.2 1.46.84 0 2.21-.5 3.28-1.15 1.09.65 2.48 1.15 3.34 1.15-.02-.49.2-1.44.2-1.46-.43 0-1.49-.27-2.38-.63.7-.77 1.14-1.77 1.25-2.61h1.36zm-3.81 1.93c-.5-.46-.85-1.13-1.01-1.93h2.09c-.17.8-.51 1.47-1 1.93l-.04.03s-.03-.02-.04-.03z'; break; case 'trash': - path = 'M12 4h3c.55 0 1 .45 1 1v1H3V5c0-.55.45-1 1-1h3c.23-1.14 1.29-2 2.5-2s2.27.86 2.5 2zM8 4h3c-.21-.58-.85-1-1.5-1S8.21 3.42 8 4zM4 7h11v10c0 .55-.45 1-1 1H5c-.55 0-1-.45-1-1V7zm3 9V9H6v7h1zm3 0V9H9v7h1zm3 0V9h-1v7h1z'; + path = 'M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z'; break; case 'twitter': path = 'M18.94 4.46c-.49.73-1.11 1.38-1.83 1.9.01.15.01.31.01.47 0 4.85-3.69 10.44-10.43 10.44-2.07 0-4-.61-5.63-1.65.29.03.58.05.88.05 1.72 0 3.3-.59 4.55-1.57-1.6-.03-2.95-1.09-3.42-2.55.22.04.45.07.69.07.33 0 .66-.05.96-.13-1.67-.34-2.94-1.82-2.94-3.6v-.04c.5.27 1.06.44 1.66.46-.98-.66-1.63-1.78-1.63-3.06 0-.67.18-1.3.5-1.84 1.81 2.22 4.51 3.68 7.56 3.83-.06-.27-.1-.55-.1-.84 0-2.02 1.65-3.66 3.67-3.66 1.06 0 2.01.44 2.68 1.16.83-.17 1.62-.47 2.33-.89-.28.85-.86 1.57-1.62 2.02.75-.08 1.45-.28 2.11-.57z'; diff --git a/components/form-toggle/index.js b/components/form-toggle/index.js index 20571ad5ef8753..4bb1c279be986a 100644 --- a/components/form-toggle/index.js +++ b/components/form-toggle/index.js @@ -27,7 +27,7 @@ function FormToggle( { className, checked, id, onChange = noop, showHint = true className="components-form-toggle__input" id={ id } type="checkbox" - value={ checked } + checked={ checked } onChange={ onChange } /> { showHint && diff --git a/components/form-toggle/style.scss b/components/form-toggle/style.scss index bb91893cd893fb..3b5eddd0cbe216 100644 --- a/components/form-toggle/style.scss +++ b/components/form-toggle/style.scss @@ -72,6 +72,7 @@ $toggle-border-width: 2px; .components-form-toggle__hint { display: inline-block; + min-width: 24px; // This prevents a position jog when the control is right aligned, and the width of the label changes margin-left: 10px; font-weight: 500; } diff --git a/components/form-toggle/test/index.js b/components/form-toggle/test/index.js index 72a8d15d3d0fbb..34500ccd1c6fe3 100644 --- a/components/form-toggle/test/index.js +++ b/components/form-toggle/test/index.js @@ -17,15 +17,15 @@ describe( 'FormToggle', () => { expect( formToggle.hasClass( 'components-form-toggle' ) ).to.be.true(); expect( formToggle.hasClass( 'is-checked' ) ).to.be.false(); expect( formToggle.type() ).to.equal( 'span' ); - expect( formToggle.find( '.components-form-toggle__input' ).prop( 'value' ) ).to.be.undefined(); + expect( formToggle.find( '.components-form-toggle__input' ).prop( 'checked' ) ).to.be.undefined(); expect( formToggle.find( '.components-form-toggle__hint' ).text() ).to.equal( 'Off' ); expect( formToggle.find( '.components-form-toggle__hint' ).prop( 'aria-hidden' ) ).to.be.true(); } ); - it( 'should render a checked checkbox and change the accessability text to On when providing checked prop', () => { + it( 'should render a checked checkbox and change the accessibility text to On when providing checked prop', () => { const formToggle = shallow(); expect( formToggle.hasClass( 'is-checked' ) ).to.be.true(); - expect( formToggle.find( '.components-form-toggle__input' ).prop( 'value' ) ).to.be.true(); + expect( formToggle.find( '.components-form-toggle__input' ).prop( 'checked' ) ).to.be.true(); expect( formToggle.find( '.components-form-toggle__hint' ).text() ).to.equal( 'On' ); } ); diff --git a/components/form-token-field/README.md b/components/form-token-field/README.md index d979c49b9ed1bf..24935da716bb6a 100644 --- a/components/form-token-field/README.md +++ b/components/form-token-field/README.md @@ -41,6 +41,7 @@ The `value` property is handled in a manner similar to controlled form component Otherwise the REST API won't save them.) - `onChange` - Function to call when the tokens have changed. An array of new tokens is passed to the callback. +- `onInputChange` - Function to call when the users types in the input field. It can be used to trigger autocomplete requests. - `onFocus` - Function to call when the TokenField has been focused on. The event is passed to the callback. Useful for analytics. - `suggestions` - An array of strings to present to the user as suggested tokens. diff --git a/components/form-token-field/index.js b/components/form-token-field/index.js index 059c3ab5ac8d4a..bc74ab311df5de 100644 --- a/components/form-token-field/index.js +++ b/components/form-token-field/index.js @@ -1,12 +1,13 @@ /** * External dependencies */ -import { last, take, clone, uniq, map, difference, each, identity, some } from 'lodash'; +import { last, take, clone, uniq, map, difference, each, identity, some, throttle } from 'lodash'; import classnames from 'classnames'; /** * WordPress dependencies */ +import { __, _n, sprintf } from 'i18n'; import { Component } from 'element'; /** @@ -16,6 +17,7 @@ import './style.scss'; import Token from './token'; import TokenInput from './token-input'; import SuggestionsList from './suggestions-list'; +import withInstanceId from '../higher-order/with-instance-id'; const initialState = { incompleteTokenValue: '', @@ -44,6 +46,7 @@ class FormTokenField extends Component { this.onInputChange = this.onInputChange.bind( this ); this.bindInput = this.bindInput.bind( this ); this.bindTokensAndInput = this.bindTokensAndInput.bind( this ); + this.throlltedSpeak = throttle( this.speak.bind( this ), 1000 ); } componentDidUpdate() { @@ -172,16 +175,33 @@ class FormTokenField extends Component { const text = event.value; const separator = this.props.tokenizeOnSpace ? /[ ,\t]+/ : /[,\t]+/; const items = text.split( separator ); + const tokenValue = last( items ) || ''; if ( items.length > 1 ) { this.addNewTokens( items.slice( 0, -1 ) ); } this.setState( { - incompleteTokenValue: last( items ) || '', + incompleteTokenValue: tokenValue, selectedSuggestionIndex: -1, selectedSuggestionScroll: false, } ); + + this.props.onInputChange( tokenValue ); + + const showMessage = tokenValue.trim().length > 1; + if ( showMessage ) { + const matchingSuggestions = this.getMatchingSuggestions( tokenValue ); + if ( !! matchingSuggestions.length ) { + this.throlltedSpeak( sprintf( _n( + '%d result found, use up and down arrow keys to navigate.', + '%d results found, use up and down arrow keys to navigate.', + matchingSuggestions.length + ), matchingSuggestions.length ) ); + } else { + this.throlltedSpeak( __( 'No results.' ) ); + } + } } handleDeleteKey( deleteToken ) { @@ -227,7 +247,13 @@ class FormTokenField extends Component { this.setState( ( state, props ) => ( { selectedSuggestionIndex: Math.min( ( state.selectedSuggestionIndex + 1 ) || 0, - this.getMatchingSuggestions( state, props ).length - 1 + this.getMatchingSuggestions( + state.incompleteTokenValue, + props.suggestions, + props.value, + props.maxSuggestions, + props.saveTransform + ).length - 1 ), selectedSuggestionScroll: true, } ) ); @@ -314,6 +340,7 @@ class FormTokenField extends Component { addNewToken( token ) { this.addNewTokens( [ token ] ); + this.speak( this.props.messages.added ); this.setState( { incompleteTokenValue: '', @@ -331,6 +358,7 @@ class FormTokenField extends Component { return this.getTokenValue( item ) !== this.getTokenValue( token ); } ); this.props.onChange( newTokens ); + this.speak( this.props.messages.removed ); } getTokenValue( token ) { @@ -341,20 +369,25 @@ class FormTokenField extends Component { return token; } - getMatchingSuggestions( state = this.state, props = this.props ) { - let suggestions = props.suggestions; - let match = props.saveTransform( state.incompleteTokenValue ); + getMatchingSuggestions( + searchValue = this.state.incompleteTokenValue, + suggestions = this.props.suggestions, + value = this.props.value, + maxSuggestions = this.props.maxSuggestions, + saveTransform = this.props.saveTransform, + ) { + let match = saveTransform( searchValue ); const startsWithMatch = []; const containsMatch = []; if ( match.length === 0 ) { - suggestions = difference( suggestions, props.value ); + suggestions = difference( suggestions, value ); } else { match = match.toLocaleLowerCase(); each( suggestions, ( suggestion ) => { const index = suggestion.toLocaleLowerCase().indexOf( match ); - if ( props.value.indexOf( suggestion ) === -1 ) { + if ( value.indexOf( suggestion ) === -1 ) { if ( index === 0 ) { startsWithMatch.push( suggestion ); } else if ( index > 0 ) { @@ -366,7 +399,11 @@ class FormTokenField extends Component { suggestions = startsWithMatch.concat( containsMatch ); } - return take( suggestions, props.maxSuggestions ); + return take( suggestions, maxSuggestions ); + } + + speak( message ) { + wp.a11y.speak( message, 'assertive' ); } getSelectedSuggestion() { @@ -416,14 +453,16 @@ class FormTokenField extends Component { onMouseEnter={ token.onMouseEnter } onMouseLeave={ token.onMouseLeave } disabled={ 'error' !== status && this.props.disabled } + messages={ this.props.messages } /> ); } renderInput() { - const { autoCapitalize, autoComplete, maxLength, value, placeholder } = this.props; + const { autoCapitalize, autoComplete, maxLength, value, placeholder, instanceId } = this.props; let props = { + instanceId, autoCapitalize, autoComplete, ref: this.bindInput, @@ -431,6 +470,8 @@ class FormTokenField extends Component { disabled: this.props.disabled, value: this.state.incompleteTokenValue, onBlur: this.onBlur, + isExpanded: this.state.isActive, + selectedSuggestionIndex: this.state.selectedSuggestionIndex, }; if ( value.length === 0 && placeholder ) { @@ -447,7 +488,11 @@ class FormTokenField extends Component { } render() { - const { disabled } = this.props; + const { + disabled, + placeholder = _( 'Add item.' ), + instanceId, + } = this.props; const classes = classnames( 'components-form-token-field', { 'is-active': this.state.isActive, 'is-disabled': disabled, @@ -458,6 +503,8 @@ class FormTokenField extends Component { className: classes, tabIndex: '-1', }; + const matchingSuggestions = this.getMatchingSuggestions(); + const showSuggestions = this.state.incompleteTokenValue.trim().length > 1; if ( ! disabled ) { tokenFieldProps = Object.assign( {}, tokenFieldProps, { @@ -469,6 +516,9 @@ class FormTokenField extends Component { return ( +); } @@ -500,9 +557,15 @@ FormTokenField.defaultProps = { displayTransform: identity, saveTransform: ( token ) => token.trim(), onChange: () => {}, + onInputChange: () => {}, isBorderless: false, disabled: false, tokenizeOnSpace: false, + messages: { + added: __( 'Item added.' ), + removed: __( 'Item removed.' ), + remove: __( 'Remove item: %s.' ), + }, }; -export default FormTokenField; +export default withInstanceId( FormTokenField ); diff --git a/components/form-token-field/suggestions-list.js b/components/form-token-field/suggestions-list.js index a455e9932074f4..40f06232d55bde 100644 --- a/components/form-token-field/suggestions-list.js +++ b/components/form-token-field/suggestions-list.js @@ -81,7 +81,13 @@ class SuggestionsList extends Component { // why, since usually a div isn't focusable by default // TODO does this still apply now that it's a{ this.renderTokensAndInput() }-+ + { showSuggestions && ( + + ) } + + { __( 'Separate with commas' ) } +and not a
? return ( -+
{ map( this.props.suggestions, ( suggestion, index ) => { const match = this.computeSuggestionMatch( suggestion ); @@ -89,17 +95,22 @@ class SuggestionsList extends Component { 'is-selected': index === this.props.selectedIndex, } ); - /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ + /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ return (
diff --git a/components/form-token-field/test/index.js b/components/form-token-field/test/index.js index 0d0dceaf1d0772..88517e684392f7 100644 --- a/components/form-token-field/test/index.js +++ b/components/form-token-field/test/index.js @@ -133,9 +133,10 @@ describe( 'FormTokenField', function() { } ); describe( 'suggestions', function() { - it( 'should render default suggestions', function() { - // limited by maxSuggestions (default 100 so doesn't matter here) - expect( getSuggestionsText() ).to.deep.equal( wrapper.state( 'tokenSuggestions' ) ); + it( 'should not render suggestions unless we type at least two characters', function() { + expect( getSuggestionsText() ).to.eql( [] ); + setText( 'th' ); + expect( getSuggestionsText() ).to.eql( fixtures.matchingSuggestions.th ); } ); it( 'should remove already added tags from suggestions', function() { @@ -145,32 +146,13 @@ describe( 'FormTokenField', function() { expect( getSuggestionsText() ).to.not.include.members( getTokensHTML() ); } ); - it( 'should suggest partial matches', function() { - setText( 't' ); - expect( getSuggestionsText() ).to.deep.equal( fixtures.matchingSuggestions.t ); - } ); - it( 'suggestions that begin with match are boosted', function() { - setText( 's' ); - expect( getSuggestionsText() ).to.deep.equal( fixtures.matchingSuggestions.s ); - } ); - - it( 'should display suggestions with escaped special characters properly', function() { - wrapper.setState( { - tokenSuggestions: fixtures.specialSuggestions.textEscaped, - } ); - expect( getSuggestionsText() ).to.deep.equal( fixtures.specialSuggestions.htmlEscaped ); - } ); - - it( 'should display suggestions with special characters properly', function() { - wrapper.setState( { - tokenSuggestions: fixtures.specialSuggestions.textUnescaped, - } ); - expect( getSuggestionsText() ).to.deep.equal( fixtures.specialSuggestions.htmlUnescaped ); + setText( 'so' ); + expect( getSuggestionsText() ).to.deep.equal( fixtures.matchingSuggestions.so ); } ); it( 'should match against the unescaped values of suggestions with special characters', function() { - setText( '&' ); + setText( '& S' ); wrapper.setState( { tokenSuggestions: fixtures.specialSuggestions.textUnescaped, } ); @@ -202,30 +184,30 @@ describe( 'FormTokenField', function() { // We need a high timeout here to accomodate Travis CI this.timeout( 10000 ); - setText( 't' ); - expect( getSuggestionsText() ).to.deep.equal( fixtures.matchingSuggestions.t ); + setText( 'th' ); + expect( getSuggestionsText() ).to.deep.equal( fixtures.matchingSuggestions.th ); expect( getSelectedSuggestion() ).to.equal( null ); sendKeyDown( keyCodes.downArrow ); // 'the' - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'he' ] ); - sendKeyDown( keyCodes.downArrow ); // 'to' - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'o' ] ); + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'e' ] ); + sendKeyDown( keyCodes.downArrow ); // 'that' + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'at' ] ); - const hoverSuggestion = tokenFieldNode.find( '.components-form-token-field__suggestion' ).at( 5 ); // 'it' - expect( getSuggestionNodeText( hoverSuggestion ) ).to.deep.equal( [ 'i', 't' ] ); + const hoverSuggestion = tokenFieldNode.find( '.components-form-token-field__suggestion' ).at( 3 ); // 'with' + expect( getSuggestionNodeText( hoverSuggestion ) ).to.deep.equal( [ 'wi', 'th' ] ); // before sending a hover event, we need to wait for // SuggestionList#_scrollingIntoView to become false this.clock.tick( 100 ); hoverSuggestion.simulate( 'mouseEnter' ); - expect( getSelectedSuggestion() ).to.deep.equal( [ 'i', 't' ] ); + expect( getSelectedSuggestion() ).to.deep.equal( [ 'wi', 'th' ] ); sendKeyDown( keyCodes.upArrow ); - expect( getSelectedSuggestion() ).to.deep.equal( [ 'wi', 't', 'h' ] ); + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'is' ] ); sendKeyDown( keyCodes.upArrow ); - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'his' ] ); + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'at' ] ); hoverSuggestion.simulate( 'click' ); expect( getSelectedSuggestion() ).to.equal( null ); - expect( getTokensHTML() ).to.deep.equal( [ 'foo', 'bar', 'it' ] ); + expect( getTokensHTML() ).to.deep.equal( [ 'foo', 'bar', 'with' ] ); } ) ); } ); @@ -319,32 +301,31 @@ describe( 'FormTokenField', function() { 't', // initialText false, // selectSuggestion null, // expectedSuggestion - [ 'foo', 'bar', 't' ] // expectedTokens + [ 'foo', 'bar', 't' ] // expectedTokens ); } ) ); - it( 'should add the suggested token when the (non-blank) input field loses focus', test( function() { + it( 'shouldn\'t show any suggestion when the initial text is smaller than two characters', test( function() { testOnBlur( 't', // initialText true, // selectSuggestion - [ 't', 'o' ], // expectedSuggestion - [ 'foo', 'bar', 'to' ] // expectedTokens + null, // expectedSuggestion + [ 'foo', 'bar', 'to' ] // expectedTokens ); } ) ); - it( 'should not add the suggested token when the (blank) input field loses focus', test( function() { + it( 'should add the suggested token when the (non-blank) input field loses focus', test( function() { testOnBlur( - '', // initialText - true, // selectSuggestion - 'of', // expectedSuggestion - [ 'foo', 'bar' ], // expectedTokens - this.clock + 'to', // initialText + true, // selectSuggestion + [ 'to' ], // expectedSuggestion + [ 'foo', 'bar', 'to' ] // expectedTokens ); } ) ); it( 'should not lose focus when a suggestion is clicked', test( function() { // prevents regression of https://github.com/Automattic/wp-calypso/issues/1884 - + setText( 'th' ); const firstSuggestion = tokenFieldNode.find( '.components-form-token-field__suggestion' ).at( 0 ); firstSuggestion.simulate( 'click' ); @@ -364,48 +345,26 @@ describe( 'FormTokenField', function() { } ); it( 'should add tokens from the selected matching suggestion using Tab', function() { - setText( 't' ); + setText( 'th' ); expect( getSelectedSuggestion() ).to.equal( null ); sendKeyDown( keyCodes.downArrow ); // 'the' - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'he' ] ); - sendKeyDown( keyCodes.downArrow ); // 'to' - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'o' ] ); + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'e' ] ); + sendKeyDown( keyCodes.downArrow ); // 'that' + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'at' ] ); sendKeyDown( keyCodes.tab ); - expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'to' ] ); + expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'that' ] ); expect( getSelectedSuggestion() ).to.equal( null ); } ); it( 'should add tokens from the selected matching suggestion using Enter', function() { - setText( 't' ); - expect( getSelectedSuggestion() ).to.equal( null ); - sendKeyDown( keyCodes.downArrow ); // 'the' - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'he' ] ); - sendKeyDown( keyCodes.downArrow ); // 'to' - expect( getSelectedSuggestion() ).to.deep.equal( [ 't', 'o' ] ); - sendKeyDown( keyCodes.enter ); - expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'to' ] ); - expect( getSelectedSuggestion() ).to.equal( null ); - } ); - - it( 'should add tokens from the selected suggestion using Tab', function() { - expect( getSelectedSuggestion() ).to.equal( null ); - sendKeyDown( keyCodes.downArrow ); // 'the' - expect( getSelectedSuggestion() ).to.equal( 'the' ); - sendKeyDown( keyCodes.downArrow ); // 'of' - expect( getSelectedSuggestion() ).to.equal( 'of' ); - sendKeyDown( keyCodes.tab ); - expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'of' ] ); - expect( getSelectedSuggestion() ).to.equal( null ); - } ); - - it( 'should add tokens from the selected suggestion using Enter', function() { + setText( 'th' ); expect( getSelectedSuggestion() ).to.equal( null ); sendKeyDown( keyCodes.downArrow ); // 'the' - expect( getSelectedSuggestion() ).to.equal( 'the' ); - sendKeyDown( keyCodes.downArrow ); // 'of' - expect( getSelectedSuggestion() ).to.equal( 'of' ); + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'e' ] ); + sendKeyDown( keyCodes.downArrow ); // 'that' + expect( getSelectedSuggestion() ).to.deep.equal( [ 'th', 'at' ] ); sendKeyDown( keyCodes.enter ); - expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'of' ] ); + expect( wrapper.state( 'tokens' ) ).to.deep.equal( [ 'foo', 'bar', 'that' ] ); expect( getSelectedSuggestion() ).to.equal( null ); } ); } ); diff --git a/components/form-token-field/test/lib/fixtures.js b/components/form-token-field/test/lib/fixtures.js index 89c64916fe502c..b5d27598fd7802 100644 --- a/components/form-token-field/test/lib/fixtures.js +++ b/components/form-token-field/test/lib/fixtures.js @@ -7,13 +7,10 @@ export default { }, specialSuggestions: { textEscaped: [ '<3', 'Stuff & Things', 'Tags & Stuff', 'Tags & Stuff 2' ], - htmlEscaped: [ '<3', 'Stuff & Things', 'Tags & Stuff', 'Tags & Stuff 2' ], textUnescaped: [ '<3', 'Stuff & Things', 'Tags & Stuff', 'Tags & Stuff 2' ], - htmlUnescaped: [ '<3', 'Stuff & Things', 'Tags & Stuff', 'Tags & Stuff 2' ], matchAmpersandUnescaped: [ - [ 'Stuff ', '&', ' Things' ], - [ 'Tags ', '&', ' Stuff' ], - [ 'Tags ', '&', ' Stuff 2' ], + [ 'Tags ', '& S', 'tuff' ], + [ 'Tags ', '& S', 'tuff 2' ], ], matchAmpersandSequence: [ [ 'Tag', 's &', ' Stuff' ], @@ -22,28 +19,20 @@ export default { matchAmpersandEscaped: [], }, matchingSuggestions: { - t: [ - [ 't', 'he' ], - [ 't', 'o' ], - [ 't', 'hat' ], - [ 't', 'his' ], - [ 'wi', 't', 'h' ], - [ 'i', 't' ], - [ 'no', 't' ], - [ 'a', 't' ], + th: [ + [ 'th', 'e' ], + [ 'th', 'at' ], + [ 'th', 'is' ], + [ 'wi', 'th' ], ], - s: [ - [ 's', 'nake' ], - [ 's', 'ound' ], - [ 'i', 's' ], - [ 'thi', 's' ], - [ 'a', 's' ], - [ 'wa', 's' ], - [ 'pipe', 's' ], + so: [ + [ 'so', 'und' ], + [ 'as', 'so', 'ciate' ], ], at: [ [ 'at' ], [ 'th', 'at' ], + [ 'associ', 'at', 'e' ], ], }, }; diff --git a/components/form-token-field/test/lib/token-field-wrapper.js b/components/form-token-field/test/lib/token-field-wrapper.js index 166c1e8a6eb781..e73e1243388c4a 100644 --- a/components/form-token-field/test/lib/token-field-wrapper.js +++ b/components/form-token-field/test/lib/token-field-wrapper.js @@ -12,7 +12,7 @@ import TokenField from '../../'; const suggestions = [ 'the', 'of', 'and', 'to', 'a', 'in', 'for', 'is', 'on', 'that', 'by', 'this', 'with', 'i', 'you', 'it', 'not', 'or', 'be', 'are', 'from', 'at', 'as', 'your', 'all', 'have', 'new', 'more', 'an', 'was', 'we', - 'snake', 'pipes', 'sound', + 'associate', 'snake', 'pipes', 'sound', ]; function unescapeAndFormatSpaces( str ) { diff --git a/components/form-token-field/token-input.js b/components/form-token-field/token-input.js index c8b9314ff43583..0e904c16801fa8 100644 --- a/components/form-token-field/token-input.js +++ b/components/form-token-field/token-input.js @@ -29,17 +29,26 @@ class TokenInput extends Component { } render() { - const props = { ...this.props, onChange: this.onChange }; - const { value, placeholder } = props; + const { value, placeholder, isExpanded, instanceId, selectedSuggestionIndex, ...props } = this.props; const size = ( ( value.length === 0 && placeholder && placeholder.length ) || value.length ) + 1; return ( ); } diff --git a/components/form-token-field/token.js b/components/form-token-field/token.js index e16734d413435d..2e03e3cf980e7e 100644 --- a/components/form-token-field/token.js +++ b/components/form-token-field/token.js @@ -7,6 +7,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ +import { sprintf } from 'i18n'; import IconButton from 'components/icon-button'; function Token( { @@ -19,6 +20,7 @@ function Token( { onClickRemove = noop, onMouseEnter, onMouseLeave, + messages, } ) { const tokenClasses = classnames( 'components-form-token-field__token', { 'is-error': 'error' === status, @@ -41,10 +43,12 @@ function Token( { { displayTransform( value ) } +- + onMouseEnter={ this.handleHover( suggestion ) } + aria-selected={ index === this.props.selectedIndex } + > { match ? ( - + { match.suggestionBeforeMatch } { match.suggestionMatch } @@ -111,7 +122,7 @@ class SuggestionsList extends Component { }
); - /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ + /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ } ) }); diff --git a/components/html-embed/index.js b/components/html-embed/index.js deleted file mode 100644 index c4e113f13e54d4..00000000000000 --- a/components/html-embed/index.js +++ /dev/null @@ -1,33 +0,0 @@ -// When embedding HTML from the WP oEmbed proxy, we need to insert it -// into a div and make sure any scripts get run. This component takes -// HTML and puts it into a div element, and creates and adds new script -// elements so all scripts get run as expected. - -export default class HtmlEmbed extends wp.element.Component { - - componentDidMount() { - const body = this.node; - const { html = '' } = this.props; - - body.innerHTML = html; - - const scripts = body.getElementsByTagName( 'script' ); - const newScripts = Array.from( scripts ).map( ( script ) => { - const newScript = document.createElement( 'script' ); - if ( script.src ) { - newScript.src = script.src; - } else { - newScript.innerHTML = script.innerHTML; - } - return newScript; - } ); - - newScripts.forEach( ( script ) => body.appendChild( script ) ); - } - - render() { - return ( - this.node = node } /> - ); - } -} diff --git a/components/icon-button/style.scss b/components/icon-button/style.scss index 67794e0fa18274..fcc5caee91dc92 100644 --- a/components/icon-button/style.scss +++ b/components/icon-button/style.scss @@ -27,7 +27,7 @@ } &:focus { - box-shadow: 0 0 0 1px $blue-medium-400, 0 0 2px 1px $blue-medium-400; + box-shadow: $button-focus-style; outline: none; } diff --git a/components/index.js b/components/index.js index d0b4689b205334..8d5a608fa52d42 100644 --- a/components/index.js +++ b/components/index.js @@ -4,13 +4,15 @@ export { default as ClipboardButton } from './clipboard-button'; export { default as Dashicon } from './dashicon'; export { default as FormToggle } from './form-toggle'; export { default as FormTokenField } from './form-token-field'; -export { default as HtmlEmbed } from './html-embed'; export { default as IconButton } from './icon-button'; +export { default as Notice } from './notice'; +export { default as NoticeList } from './notice/list'; export { default as Panel } from './panel'; export { default as PanelHeader } from './panel/header'; export { default as PanelBody } from './panel/body'; export { default as Placeholder } from './placeholder'; export { default as ResponsiveWrapper } from './responsive-wrapper'; +export { default as SandBox } from './sandbox'; export { default as Spinner } from './spinner'; export { default as Toolbar } from './toolbar'; export { default as Popover } from './popover'; diff --git a/components/notice/index.js b/components/notice/index.js new file mode 100644 index 00000000000000..8c1b063cfde8da --- /dev/null +++ b/components/notice/index.js @@ -0,0 +1,28 @@ +/** + * External dependencies + */ +import { isString, noop } from 'lodash'; + +/** + * WordPress dependencies + */ +import { __ } from 'i18n'; + +/** + * Internal Dependencies + */ +import './style.scss'; + +function Notice( { status, content, onRemove = noop } ) { + const className = `notice notice-alt is-dismissible notice-${ status }`; + return ( ++ { isString( content ) ?+ ); +} + +export default Notice; diff --git a/components/notice/list.js b/components/notice/list.js new file mode 100644 index 00000000000000..888c755537e1c2 --- /dev/null +++ b/components/notice/list.js @@ -0,0 +1,23 @@ +/** + * External depednencies + */ +import { noop } from 'lodash'; + +/** + * Internal dependencies + */ +import Notice from './'; + +function NoticeList( { notices, onRemove = noop } ) { + const removeNotice = ( id ) => () => onRemove( id ); + + return ( +{ content }
: content } + ++ { notices.reverse().map( ( notice ) => ( ++ ); +} + +export default NoticeList; diff --git a/components/notice/style.scss b/components/notice/style.scss new file mode 100644 index 00000000000000..a57109491d4683 --- /dev/null +++ b/components/notice/style.scss @@ -0,0 +1,8 @@ +.components-notice-list { + position: fixed; + top: 40px; + right: 0; + min-width: 300px; + max-width: 400px; + z-index: z-index( ".components-notice-list" ); +} diff --git a/components/panel/style.scss b/components/panel/style.scss index 50a74919376fc7..0d0dbcfb6562e0 100644 --- a/components/panel/style.scss +++ b/components/panel/style.scss @@ -18,10 +18,13 @@ } .components-panel__body { - padding: 15px; - border: 1px solid $light-gray-500; - margin-left: -1px; - margin-right: -1px; + padding: $panel-padding; + border-top: 1px solid $light-gray-500; + border-bottom: 1px solid $light-gray-500; + + h3 { + margin: 0 0 .5em 0; + } } .components-panel__header { @@ -29,11 +32,10 @@ justify-content: space-between; align-items: center; background: $light-gray-300; - padding: 0 15px; + padding: 0 $panel-padding; height: 50px; - border: 1px solid $light-gray-500; - margin-left: -1px; - margin-right: -1px; + border-top: 1px solid $light-gray-500; + border-bottom: 1px solid $light-gray-500; h2 { margin: 0; @@ -49,7 +51,7 @@ margin-top: -1px; } -.components-panel__body-title { +.components-panel .components-panel__body-title { display: block; padding: 0; margin: 0; diff --git a/components/placeholder/index.js b/components/placeholder/index.js index fdaf803246d275..be362bdf7866ac 100644 --- a/components/placeholder/index.js +++ b/components/placeholder/index.js @@ -13,7 +13,7 @@ function Placeholder( { icon, children, label, instructions, className, ...addit const classes = classnames( 'components-placeholder', className ); return ( -+ ) ) } + +); diff --git a/editor/sidebar/post-trash/index.js b/editor/sidebar/post-trash/index.js index c737e9bf6bf1e4..938c9ea35b3dfd 100644 --- a/editor/sidebar/post-trash/index.js +++ b/editor/sidebar/post-trash/index.js @@ -13,7 +13,7 @@ import { Button, Dashicon } from 'components'; * Internal dependencies */ import './style.scss'; -import { getCurrentPost } from '../../selectors'; +import { getCurrentPostId, getCurrentPostType } from '../../selectors'; import { trashPost } from '../../actions'; function PostTrash( { postId, postType, ...props } ) { @@ -33,10 +33,9 @@ function PostTrash( { postId, postType, ...props } ) { export default connect( ( state ) => { - const post = getCurrentPost( state ); return { - postId: post.id, - postType: post.type, + postId: getCurrentPostId( state ), + postType: getCurrentPostType( state ), }; }, { trashPost } diff --git a/editor/sidebar/post-trash/style.scss b/editor/sidebar/post-trash/style.scss index 7bf64ae8fd42ba..86a55e049395f7 100644 --- a/editor/sidebar/post-trash/style.scss +++ b/editor/sidebar/post-trash/style.scss @@ -1,16 +1,14 @@ .editor-post-trash { + display: flex; + justify-content: flex-end; + align-items: center; cursor: pointer; color: inherit; flex-grow: 1; - text-align: right; - + color: $alert-red; + .dashicon { - vertical-align: middle; margin-right: -10px; margin-left: 10px; } - - &:hover { - color: $blue-medium-500; - } -} +} \ No newline at end of file diff --git a/editor/sidebar/style.scss b/editor/sidebar/style.scss index c4ba147c0046ff..aec21987f55270 100644 --- a/editor/sidebar/style.scss +++ b/editor/sidebar/style.scss @@ -7,9 +7,11 @@ width: $sidebar-width; border-left: 1px solid $light-gray-500; background: $light-gray-300; + color: $dark-gray-500; @include break-small() { position: fixed; + overflow: auto; } @include break-medium() { @@ -17,9 +19,8 @@ } > .components-panel { - margin-left: -1px; - margin-right: -1px; - + border-left: none; + border-right: none; &:first-child { margin-top: -1px; } @@ -28,6 +29,31 @@ margin-bottom: -1px; } } + + p { + margin-top: 0; + } + + h3 { + font-size: $default-font-size; + color: $dark-gray-500; + margin-bottom: 1.5em; + } + + hr { + border-top: none; + border-bottom: 1px solid $light-gray-500; + margin: 1.5em 0; + } + + ul.components-toolbar { + box-shadow: none; + margin-bottom: 1.5em; + } + + p + ul.components-toolbar { + margin-top: -1em; + } } /* Visual and Text editor both */ diff --git a/editor/state.js b/editor/state.js index 7163612843fe38..c9bdf78afdaaea 100644 --- a/editor/state.js +++ b/editor/state.js @@ -463,6 +463,24 @@ export function saving( state = {}, action ) { return state; } +export function notices( state = {}, action ) { + switch ( action.type ) { + case 'CREATE_NOTICE': + return { + ...state, + [ action.notice.id ]: action.notice, + }; + case 'REMOVE_NOTICE': + if ( ! state.hasOwnProperty( action.noticeId ) ) { + return state; + } + + return omit( state, action.noticeId ); + } + + return state; +} + /** * Creates a new instance of a Redux store. * @@ -479,6 +497,7 @@ export function createReduxStore() { mode, isSidebarOpened, saving, + notices, } ) ); const enhancers = [ applyMiddleware( refx( effects ) ) ]; diff --git a/editor/test/selectors.js b/editor/test/selectors.js index 42bc6f11cde66e..a92f4bfadf17bf 100644 --- a/editor/test/selectors.js +++ b/editor/test/selectors.js @@ -16,6 +16,7 @@ import { isEditedPostDirty, getCurrentPost, getCurrentPostId, + getCurrentPostType, getPostEdits, getEditedPostTitle, getEditedPostExcerpt, @@ -50,6 +51,7 @@ import { didPostSaveRequestSucceed, didPostSaveRequestFail, getSuggestedPostFormat, + getNotices, } from '../selectors'; describe( 'selectors', () => { @@ -207,6 +209,18 @@ describe( 'selectors', () => { } ); } ); + describe( 'getCurrentPostType', () => { + it( 'should return the post type', () => { + const state = { + currentPost: { + type: 'post', + }, + }; + + expect( getCurrentPostType( state ) ).to.equal( 'post' ); + } ); + } ); + describe( 'getPostEdits', () => { it( 'should return the post edits', () => { const state = { @@ -1177,4 +1191,20 @@ describe( 'selectors', () => { expect( getSuggestedPostFormat( state ) ).to.equal( 'Quote' ); } ); } ); + + describe( 'getNotices', () => { + it( 'should return the notices array', () => { + const state = { + notices: { + b: { id: 'b', content: 'Post saved' }, + a: { id: 'a', content: 'Error saving' }, + }, + }; + + expect( getNotices( state ) ).to.eql( [ + state.notices.b, + state.notices.a, + ] ); + } ); + } ); } ); diff --git a/editor/test/state.js b/editor/test/state.js index 48c2d41bb4e45b..3ce83adcdad85f 100644 --- a/editor/test/state.js +++ b/editor/test/state.js @@ -5,6 +5,11 @@ import { expect } from 'chai'; import { values } from 'lodash'; import deepFreeze from 'deep-freeze'; +/** + * WordPress dependencies + */ +import { registerBlockType, unregisterBlockType } from 'blocks'; + /** * Internal dependencies */ @@ -17,6 +22,7 @@ import { mode, isSidebarOpened, saving, + notices, showInsertionPoint, createReduxStore, } from '../state'; @@ -24,11 +30,11 @@ import { describe( 'state', () => { describe( 'editor()', () => { before( () => { - wp.blocks.registerBlockType( 'core/test-block', {} ); + registerBlockType( 'core/test-block', {} ); } ); after( () => { - wp.blocks.unregisterBlockType( 'core/test-block' ); + unregisterBlockType( 'core/test-block' ); } ); it( 'should return empty blocksByUid, blockOrder, history by default', () => { @@ -973,6 +979,56 @@ describe( 'state', () => { } ); } ); + describe( 'notices()', () => { + it( 'should create a notice', () => { + const originalState = { + b: { + id: 'b', + content: 'Error saving', + status: 'error', + }, + }; + const state = notices( originalState, { + type: 'CREATE_NOTICE', + notice: { + id: 'a', + content: 'Post saved', + status: 'success', + }, + } ); + expect( state ).to.eql( { + b: originalState.b, + a: { + id: 'a', + content: 'Post saved', + status: 'success', + }, + } ); + } ); + + it( 'should remove a notice', () => { + const originalState = { + a: { + id: 'a', + content: 'Post saved', + status: 'success', + }, + b: { + id: 'b', + content: 'Error saving', + status: 'error', + }, + }; + const state = notices( originalState, { + type: 'REMOVE_NOTICE', + noticeId: 'a', + } ); + expect( state ).to.eql( { + b: originalState.b, + } ); + } ); + } ); + describe( 'createReduxStore()', () => { it( 'should return a redux store', () => { const store = createReduxStore(); @@ -996,6 +1052,7 @@ describe( 'state', () => { 'isSidebarOpened', 'saving', 'showInsertionPoint', + 'notices', ] ); } ); } ); diff --git a/editor/utils/dom.js b/editor/utils/dom.js new file mode 100644 index 00000000000000..ec3feb0f17ba71 --- /dev/null +++ b/editor/utils/dom.js @@ -0,0 +1,13 @@ + +/** + * Utility function to check whether the domElement provided is editable or not + * An editable element means we can type in it to edit its content + * This includes inputs and contenteditables + * + * @param {DomElement} domElement DOM Element + * @return {Boolean} Whether the DOM Element is editable or not + */ +export function isEditableElement( domElement ) { + return [ 'textarea', 'input', 'select' ].indexOf( domElement.tagName.toLowerCase() ) !== -1 + || !! domElement.isContentEditable; +} diff --git a/editor/utils/test/dom.js b/editor/utils/test/dom.js new file mode 100644 index 00000000000000..a51bbd82786158 --- /dev/null +++ b/editor/utils/test/dom.js @@ -0,0 +1,35 @@ +/** + * External dependencies + */ +import { expect } from 'chai'; + +/** + * Internal dependencies + */ +import { isEditableElement } from '../dom'; + +describe( 'isEditableElement', () => { + it( 'should return false for non editable nodes', () => { + const div = document.createElement( 'div' ); + + expect( isEditableElement( div ) ).to.be.false(); + } ); + + it( 'should return true for inputs', () => { + const input = document.createElement( 'input' ); + + expect( isEditableElement( input ) ).to.be.true(); + } ); + + it( 'should return true for textareas', () => { + const textarea = document.createElement( 'textarea' ); + + expect( isEditableElement( textarea ) ).to.be.true(); + } ); + + it( 'should return true for selects', () => { + const select = document.createElement( 'select' ); + + expect( isEditableElement( select ) ).to.be.true(); + } ); +} ); diff --git a/gutenberg.php b/gutenberg.php index 532fffbdf6725b..e4be0409a7077f 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -3,7 +3,7 @@ * Plugin Name: Gutenberg * Plugin URI: https://github.com/WordPress/gutenberg * Description: Printing since 1440. This is the development plugin for the new block editor in core. Meant for development, do not run on real sites. - * Version: 0.1.0 + * Version: 0.3.0 * Author: Gutenberg Team * * @package gutenberg @@ -21,6 +21,7 @@ require_once dirname( __FILE__ ) . '/lib/blocks.php'; require_once dirname( __FILE__ ) . '/lib/client-assets.php'; require_once dirname( __FILE__ ) . '/lib/i18n.php'; + require_once dirname( __FILE__ ) . '/lib/parser.php'; require_once dirname( __FILE__ ) . '/lib/register.php'; // Register server-side code for individual blocks. diff --git a/index.php b/index.php deleted file mode 100644 index a018a805072eec..00000000000000 --- a/index.php +++ /dev/null @@ -1,14 +0,0 @@ -unregister( $name ); } -/** - * Extract the block attributes from the block's attributes string - * - * @since 0.1.0 - * - * @param string $attr_string Attributes string. - - * @return array - */ -function parse_block_attributes( $attr_string ) { - $attributes_matcher = '/([^\s]+)="([^"]+)"\s*/'; - preg_match_all( $attributes_matcher, $attr_string, $matches ); - $attributes = array(); - foreach ( $matches[1] as $index => $attribute_match ) { - $attributes[ $attribute_match ] = $matches[2][ $index ]; - } - - return $attributes; -} - /** * Renders the dynamic blocks into the post content * @@ -71,48 +51,29 @@ function parse_block_attributes( $attr_string ) { function do_blocks( $content ) { $registry = WP_Block_Type_Registry::get_instance(); - // Extract the blocks from the post content. - $matcher = '#' . join( '', array( - '(?P{ !! icon &&diff --git a/editor/sidebar/last-revision/index.js b/editor/sidebar/last-revision/index.js index 005e5b15684b65..36540b7df79d16 100644 --- a/editor/sidebar/last-revision/index.js +++ b/editor/sidebar/last-revision/index.js @@ -15,7 +15,7 @@ import PanelBody from 'components/panel/body'; * Internal dependencies */ import './style.scss'; -import { getCurrentPost, isSavingPost } from '../../selectors'; +import { getCurrentPostId, getCurrentPostType, isSavingPost } from '../../selectors'; import { getWPAdminURL } from '../../utils/url'; class LastRevision extends Component { @@ -57,7 +57,11 @@ class LastRevision extends Component { } this.setState( { loading: true } ); const postIdToLoad = this.props.postId; - this.fetchRevisionsRequest = new wp.api.collections.PostRevisions( {}, { parent: postIdToLoad } ).fetch() + const Collection = wp.api.getPostTypeRevisionsCollection( this.props.postType ); + if ( ! Collection ) { + return; + } + this.fetchRevisionsRequest = new Collection( {}, { parent: postIdToLoad } ).fetch() .done( ( revisions ) => { if ( this.props.postId !== postIdToLoad ) { return; @@ -79,12 +83,17 @@ class LastRevision extends Component { render() { const { revisions } = this.state; - const lastRevision = revisions.length ? revisions[ 0 ] : null; + + if ( ! revisions.length ) { + return null; + } + + const lastRevision = revisions[ 0 ]; return (} { label } diff --git a/components/placeholder/test/index.js b/components/placeholder/test/index.js index dc8c01ad076f39..4b84f0a56489a1 100644 --- a/components/placeholder/test/index.js +++ b/components/placeholder/test/index.js @@ -35,13 +35,12 @@ describe( 'Placeholder', () => { expect( placeholderLabel.find( 'Dashicon' ).exists() ).to.be.true(); } ); - it( 'should render a label section and add aria label', () => { + it( 'should render a label section', () => { const label = 'WordPress'; const placeholder = shallow( ); const placeholderLabel = placeholder.find( '.components-placeholder__label' ); const child = placeholderLabel.childAt( 0 ); - expect( placeholder.prop( 'aria-label' ) ).to.equal( label ); expect( child.text() ).to.equal( label ); } ); diff --git a/components/popover/style.scss b/components/popover/style.scss index 3c01adcbf26379..51537e03dcae60 100644 --- a/components/popover/style.scss +++ b/components/popover/style.scss @@ -8,7 +8,7 @@ right: 0; @include break-medium { - width: 280px; + width: 300px; left: -122px; right: auto; height: auto; diff --git a/components/sandbox/index.js b/components/sandbox/index.js new file mode 100644 index 00000000000000..630939c92b6e4e --- /dev/null +++ b/components/sandbox/index.js @@ -0,0 +1,163 @@ +import { renderToString } from 'element'; + +export default class Sandbox extends wp.element.Component { + + constructor() { + super( ...arguments ); + this.state = { + width: 0, + height: 0, + }; + this.trySandbox = this.trySandbox.bind( this ); + this.checkMessageForResize = this.checkMessageForResize.bind( this ); + } + + isFrameAccessible() { + try { + return !! this.iframe.contentDocument.body; + } catch ( e ) { + return false; + } + } + + checkMessageForResize( event ) { + const iframe = this.iframe; + + // Attempt to parse the message data as JSON if passed as string + let data = event.data || {}; + if ( 'string' === typeof data ) { + try { + data = JSON.parse( data ); + } catch ( e ) {} // eslint-disable-line no-empty + } + + // Verify that the mounted element is the source of the message + if ( ! iframe || iframe.contentWindow !== event.source ) { + return; + } + + // Update the state only if the message is formatted as we expect, i.e. + // as an object with a 'resize' action, width, and height + const { action, width, height } = data; + const { width: oldWidth, height: oldHeight } = this.state; + + if ( 'resize' === action && ( oldWidth !== width || oldHeight !== height ) ) { + this.setState( { width, height } ); + } + } + + componentDidMount() { + window.addEventListener( 'message', this.checkMessageForResize, false ); + this.trySandbox(); + } + + componentDidUpdate() { + this.trySandbox(); + } + + componentWillUnmount() { + window.removeEventListener( 'message', this.checkMessageForResize ); + } + + trySandbox() { + if ( ! this.isFrameAccessible() ) { + return; + } + + const body = this.iframe.contentDocument.body; + if ( null !== body.getAttribute( 'data-resizable-iframe-connected' ) ) { + return; + } + + const observeAndResizeJS = ` + ( function() { + var observer; + + if ( ! window.MutationObserver || ! document.body || ! window.top ) { + return; + } + + function sendResize() { + window.top.postMessage( { + action: 'resize', + width: document.body.offsetWidth, + height: document.body.offsetHeight + }, '*' ); + } + + observer = new MutationObserver( sendResize ); + observer.observe( document.body, { + attributes: true, + attributeOldValue: false, + characterData: true, + characterDataOldValue: false, + childList: true, + subtree: true + } ); + + window.addEventListener( 'load', sendResize, true ); + + // Hack: Remove viewport unit styles, as these are relative + // the iframe root and interfere with our mechanism for + // determining the unconstrained page bounds. + function removeViewportStyles( ruleOrNode ) { + [ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function( style ) { + if ( /^\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] ) ) { + ruleOrNode.style[ style ] = ''; + } + } ); + } + + Array.prototype.forEach.call( document.querySelectorAll( '[style]' ), removeViewportStyles ); + Array.prototype.forEach.call( document.styleSheets, function( stylesheet ) { + Array.prototype.forEach.call( stylesheet.cssRules || stylesheet.rules, removeViewportStyles ); + } ); + + document.body.style.position = 'absolute'; + document.body.setAttribute( 'data-resizable-iframe-connected', '' ); + + sendResize(); + } )();`; + + // put the html snippet into a html document, and then write it to the iframe's document + // we can use this in the future to inject custom styles or scripts + const htmlDoc = ( + + + { this.props.title } + + + + + + + ); + + // writing the document like this makes it act in the same way as if it was + // loaded over the network, so DOM creation and mutation, script execution, etc. + // all work as expected + this.iframe.contentWindow.document.open(); + this.iframe.contentWindow.document.write( '' + renderToString( htmlDoc ) ); + this.iframe.contentWindow.document.close(); + } + + static get defaultProps() { + return { + html: '', + title: '', + }; + } + + render() { + return ( +@@ -103,7 +112,8 @@ class LastRevision extends Component { export default connect( ( state ) => { return { - postId: getCurrentPost( state ).id, + postId: getCurrentPostId( state ), + postType: getCurrentPostType( state ), isSaving: isSavingPost( state ), }; } diff --git a/editor/sidebar/post-schedule/index.js b/editor/sidebar/post-schedule/index.js index 5a1bbefd03175c..5e2e72c87dbb51 100644 --- a/editor/sidebar/post-schedule/index.js +++ b/editor/sidebar/post-schedule/index.js @@ -30,8 +30,7 @@ class PostSchedule extends Component { this.toggleDialog = this.toggleDialog.bind( this ); } - toggleDialog( event ) { - event.preventDefault(); + toggleDialog() { this.setState( ( state ) => ( { opened: ! state.opened } ) ); } @@ -61,7 +60,12 @@ class PostSchedule extends Component { return ( { __( 'Publish' ) } -+ diff --git a/editor/sidebar/post-status/style.scss b/editor/sidebar/post-status/style.scss index 41a1bc1d2e833e..82e085a5b71a8a 100644 --- a/editor/sidebar/post-status/style.scss +++ b/editor/sidebar/post-status/style.scss @@ -3,4 +3,8 @@ justify-content: space-between; align-items: center; padding-top: 20px; + + &:empty { + padding-top: 0; + } } diff --git a/editor/sidebar/post-sticky/index.js b/editor/sidebar/post-sticky/index.js new file mode 100644 index 00000000000000..5909d6ec3f6c68 --- /dev/null +++ b/editor/sidebar/post-sticky/index.js @@ -0,0 +1,52 @@ +/** + * External dependencies + */ +import { connect } from 'react-redux'; + +/** + * WordPress dependencies + */ +import { __ } from 'i18n'; +import { FormToggle, withInstanceId } from 'components'; + +/** + * Internal dependencies + */ +import { getEditedPostAttribute, getCurrentPostType } from '../../selectors'; +import { editPost } from '../../actions'; + +function PostSticky( { onUpdateSticky, postType, postSticky = false, instanceId } ) { + if ( postType !== 'post' ) { + return false; + } + + const stickyToggleId = 'post-sticky-toggle-' + instanceId; + + return ( + + ++ ); +} + +export default connect( + ( state ) => { + return { + postType: getCurrentPostType( state ), + postSticky: getEditedPostAttribute( state, 'sticky' ), + }; + }, + ( dispatch ) => { + return { + onUpdateSticky( postSticky ) { + dispatch( editPost( { sticky: postSticky } ) ); + }, + }; + }, +)( withInstanceId( PostSticky ) ); diff --git a/editor/sidebar/post-taxonomies/categories-selector.js b/editor/sidebar/post-taxonomies/categories-selector.js index 4fe33aea374ee3..d9f8aeb2f70427 100644 --- a/editor/sidebar/post-taxonomies/categories-selector.js +++ b/editor/sidebar/post-taxonomies/categories-selector.js @@ -17,9 +17,9 @@ import { getEditedPostAttribute } from '../../selectors'; import { editPost } from '../../actions'; const DEFAULT_CATEGORIES_QUERY = { - per_page: -1, + per_page: 100, orderby: 'count', - order: 'DESC', + order: 'desc', }; class CategoriesSelector extends Component { @@ -50,7 +50,8 @@ class CategoriesSelector extends Component { } componentDidMount() { - this.fetchCategoriesRequest = new wp.api.collections.Categories().fetch( DEFAULT_CATEGORIES_QUERY ) + this.fetchCategoriesRequest = new wp.api.collections.Categories() + .fetch( { data: DEFAULT_CATEGORIES_QUERY } ) .done( ( categories ) => { const availableCategories = this.buildCategoriesTree( categories ); diff --git a/editor/sidebar/post-taxonomies/style.scss b/editor/sidebar/post-taxonomies/style.scss index cbba6079e943a5..35f42e348c381c 100644 --- a/editor/sidebar/post-taxonomies/style.scss +++ b/editor/sidebar/post-taxonomies/style.scss @@ -1,6 +1,6 @@ .editor-post-taxonomies__tags-selector, .editor-post-taxonomies__categories-selector { - margin-top: 15px; + margin-top: $panel-padding; } .editor-post-taxonomies__tags-selector-title, @@ -19,5 +19,5 @@ .editor-post-taxonomies__categories-subchoices { margin-top: 5px; - margin-left: 15px; + margin-left: $panel-padding; } diff --git a/editor/sidebar/post-taxonomies/tags-selector.js b/editor/sidebar/post-taxonomies/tags-selector.js index 863c1b304c2a7c..00690a58152f67 100644 --- a/editor/sidebar/post-taxonomies/tags-selector.js +++ b/editor/sidebar/post-taxonomies/tags-selector.js @@ -2,7 +2,7 @@ * External dependencies */ import { connect } from 'react-redux'; -import { unescape, find } from 'lodash'; +import { unescape, find, throttle } from 'lodash'; /** * WordPress dependencies @@ -18,9 +18,9 @@ import { getEditedPostAttribute } from '../../selectors'; import { editPost } from '../../actions'; const DEFAULT_TAGS_QUERY = { - per_page: -1, + per_page: 100, orderby: 'count', - order: 'DESC', + order: 'desc', }; const MAX_TERMS_SUGGESTIONS = 20; @@ -28,35 +28,42 @@ class TagsSelector extends Component { constructor() { super( ...arguments ); this.onTagsChange = this.onTagsChange.bind( this ); + this.searchTags = throttle( this.searchTags.bind( this ), 500 ); + this.findOrCreateTag = this.findOrCreateTag.bind( this ); this.state = { - loading: true, + loading: false, availableTags: [], selectedTags: [], }; } componentDidMount() { - this.fetchTagsRequest = new wp.api.collections.Tags().fetch( DEFAULT_TAGS_QUERY ) - .done( ( tags ) => { - this.setState( { - loading: false, - availableTags: tags, - } ); - this.updateSelectedTags( this.props.tags ); - } ) - .fail( ( xhr ) => { - if ( xhr.statusText === 'abort' ) { - return; + if ( this.props.tags ) { + this.setState( { loading: false } ); + this.initRequest = this.fetchTags( { include: this.props.tags } ); + this.initRequest.then( + () => { + this.setState( { loading: false } ); + }, + ( xhr ) => { + if ( xhr.statusText === 'abort' ) { + return; + } + this.setState( { + loading: false, + } ); } - this.setState( { - loading: false, - } ); - } ); + ); + } + this.searchTags(); } componentWillUnmount() { - if ( this.fetchTagsRequest ) { - this.fetchTagsRequest.abort(); + if ( this.initRequest ) { + this.initRequest.abort(); + } + if ( this.searchRequest ) { + this.searchRequest.abort(); } } @@ -66,6 +73,21 @@ class TagsSelector extends Component { } } + fetchTags( params = {} ) { + const query = { ...DEFAULT_TAGS_QUERY, ...params }; + const request = new wp.api.collections.Tags().fetch( { data: query } ); + request.then( ( tags ) => { + this.setState( ( state ) => ( { + availableTags: state.availableTags.concat( + tags.filter( ( tag ) => ! find( state.availableTags, ( availableTag ) => availableTag.id === tag.id ) ) + ), + } ) ); + this.updateSelectedTags( this.props.tags ); + } ); + + return request; + } + updateSelectedTags( tags = [] ) { const selectedTags = tags.map( ( tagId ) => { const tagObject = find( this.state.availableTags, ( tag ) => tag.id === tagId ); @@ -76,6 +98,21 @@ class TagsSelector extends Component { } ); } + findOrCreateTag( tagName ) { + return new Promise( ( resolve, reject ) => { + // Tries to create a tag or fetch it if it already exists + new wp.api.models.Tag( { name: tagName } ).save() + .then( resolve, ( xhr ) => { + const errorCode = xhr.responseJSON && xhr.responseJSON.code; + if ( errorCode === 'term_exists' ) { + return new wp.api.models.Tag( { id: xhr.responseJSON.data } ) + .fetch().then( resolve, reject ); + } + reject( xhr ); + } ); + } ); + } + onTagsChange( tagNames ) { this.setState( { selectedTags: tagNames } ); const newTagNames = tagNames.filter( ( tagName ) => @@ -91,9 +128,8 @@ class TagsSelector extends Component { if ( newTagNames.length === 0 ) { return this.props.onUpdateTags( tagNamesToIds( tagNames, this.state.availableTags ) ); } - const createTag = ( tagName ) => new wp.api.models.Tag( { name: tagName } ).save(); Promise - .all( newTagNames.map( createTag ) ) + .all( newTagNames.map( this.findOrCreateTag ) ) .then( ( newTags ) => { const newAvailableTags = this.state.availableTags.concat( newTags ); this.setState( { availableTags: newAvailableTags } ); @@ -101,6 +137,13 @@ class TagsSelector extends Component { } ); } + searchTags( search = '' ) { + if ( this.searchRequest ) { + this.searchRequest.abort(); + } + this.searchRequest = this.fetchTags( { search } ); + } + render() { const { loading, availableTags, selectedTags } = this.state; const tagNames = availableTags.map( ( tag ) => tag.name ); @@ -113,8 +156,15 @@ class TagsSelector extends Component { displayTransform={ unescape } suggestions={ tagNames } onChange={ this.onTagsChange } + onInputChange={ this.searchTags } maxSuggestions={ MAX_TERMS_SUGGESTIONS } disabled={ loading } + placeholder={ __( 'Add New Tag' ) } + messages={ { + added: __( 'Tag added.' ), + removed: __( 'Tag removed.' ), + remove: __( 'Remove tag: %s.' ), + } } />onUpdateSticky( ! postSticky ) } + showHint={ false } + id={ stickyToggleId } + /> + ).)*)', - '\s*/?-->\n?)', - '(?:', - '(?P .*?)', - '(?P \n?)', - ')?', - ) ) . '#s'; - preg_match_all( $matcher, $content, $matches, PREG_OFFSET_CAPTURE ); + $parser = new Gutenberg_PEG_Parser; + $blocks = $parser->parse( $content ); - $new_content = $content; - $offset_differential = 0; - foreach ( $matches[0] as $index => $block_match ) { - $block_type_name = $matches['block_type_name'][ $index ][0]; - $block_type = $registry->get_registered( $block_type_name ); + $content_after_blocks = ''; - $output = ''; - if ( null !== $block_type ) { - $block_attributes_string = $matches['attributes'][ $index ][0]; - $block_attributes = parse_block_attributes( $block_attributes_string ); + foreach ( $blocks as $block ) { + $block_name = isset( $block['blockName'] ) ? $block['blockName'] : null; + $attributes = is_array( $block['attrs'] ) ? $block['attrs'] : array(); - // Call the block's render function to generate the dynamic output. - $output = call_user_func( $block_type->render, $block_attributes ); - } elseif ( isset( $matches['content'][ $index ][0] ) ) { - $output = $matches['content'][ $index ][0]; + if ( $block_name ) { + $block_type = $registry->get_registered( $block_name ); + if ( null !== $block_type ) { + $content_after_blocks .= call_user_func( + $block_type->render, + $attributes + ); + continue; + } } - // Replace the matched block with the static or dynamic output. - $new_content = substr_replace( - $new_content, - $output, - $block_match[1] - $offset_differential, - strlen( $block_match[0] ) - ); - - // Update offset for the next replacement. - $offset_differential += strlen( $block_match[0] ) - strlen( $output ); + $content_after_blocks .= $block['rawContent']; } - return $new_content; + return $content_after_blocks; } add_filter( 'the_content', 'do_blocks', 9 ); // BEFORE do_shortcode() and wpautop(). diff --git a/lib/blocks/latest-posts.php b/lib/blocks/latest-posts.php index 60719e9a12921e..8e2238b34dfbfb 100644 --- a/lib/blocks/latest-posts.php +++ b/lib/blocks/latest-posts.php @@ -55,6 +55,6 @@ function gutenberg_render_block_core_latest_posts( $attributes ) { return $block_content; } -register_block_type( 'core/latestposts', array( +register_block_type( 'core/latest-posts', array( 'render' => 'gutenberg_render_block_core_latest_posts', ) ); diff --git a/lib/client-assets.php b/lib/client-assets.php index 3aca0639473e73..d13492e66f0058 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -97,7 +97,7 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-components', gutenberg_url( 'components/build/index.js' ), - array( 'wp-element' ), + array( 'wp-element', 'wp-a11y' ), filemtime( gutenberg_dir_path() . 'components/build/index.js' ) ); wp_register_script( @@ -120,6 +120,12 @@ function gutenberg_register_scripts_and_styles() { array(), filemtime( gutenberg_dir_path() . 'blocks/build/style.css' ) ); + wp_register_style( + 'wp-edit-blocks', + gutenberg_url( 'blocks/build/edit-blocks.css' ), + array(), + filemtime( gutenberg_dir_path() . 'blocks/build/edit-blocks.css' ) + ); } add_action( 'init', 'gutenberg_register_scripts_and_styles' ); @@ -289,6 +295,70 @@ function gutenberg_register_vendor_script( $handle, $src, $deps = array() ) { ); } +/** + * Extend wp-api Backbone client with methods to look up the REST API endpoints for all post types. + * + * This is temporary while waiting for #41111 in core. + * + * @link https://core.trac.wordpress.org/ticket/41111 + */ +function gutenberg_extend_wp_api_backbone_client() { + $post_type_rest_base_mapping = array(); + foreach ( get_post_types( array(), 'objects' ) as $post_type_object ) { + $rest_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name; + $post_type_rest_base_mapping[ $post_type_object->name ] = $rest_base; + } + $script = sprintf( 'wp.api.postTypeRestBaseMapping = %s;', wp_json_encode( $post_type_rest_base_mapping ) ); + $script .= << [\\\\d]+)'; + return _.first( _.filter( wp.api.models, function( model ) { + return model.prototype.route && route === model.prototype.route.index; + } ) ); + }; + wp.api.getPostTypeRevisionsCollection = function( postType ) { + var route = '/' + wpApiSettings.versionString + this.postTypeRestBaseMapping[ postType ] + '/(?P [\\\\d]+)/revisions'; + return _.first( _.filter( wp.api.collections, function( model ) { + return model.prototype.route && route === model.prototype.route.index; + } ) ); + }; +JS; + wp_add_inline_script( 'wp-api', $script ); +} + +/** + * Get post to edit. + * + * @param int $post_id Post ID to edit. + * @return array|WP_Error The post resource data or a WP_Error on failure. + */ +function gutenberg_get_post_to_edit( $post_id ) { + $post = get_post( $post_id ); + if ( ! $post ) { + return new WP_Error( 'post_not_found', __( 'Post not found.', 'gutenberg' ) ); + } + + $post_type_object = get_post_type_object( $post->post_type ); + if ( ! $post_type_object ) { + return new WP_Error( 'unrecognized_post_type', __( 'Unrecognized post type.', 'gutenberg' ) ); + } + + if ( ! current_user_can( 'edit_post', $post->ID ) ) { + return new WP_Error( 'unauthorized_post_type', __( 'Unauthorized post type.', 'gutenberg' ) ); + } + + $request = new WP_REST_Request( + 'GET', + sprintf( '/wp/v2/%s/%d', ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name, $post->ID ) + ); + $request->set_param( 'context', 'edit' ); + $response = rest_do_request( $request ); + if ( $response->is_error() ) { + return $response->as_error(); + } + return $response->get_data(); +} + /** * Scripts & Styles. * @@ -311,6 +381,8 @@ function gutenberg_scripts_and_styles( $hook ) { */ wp_enqueue_media(); + gutenberg_extend_wp_api_backbone_client(); + // The editor code itself. wp_enqueue_script( 'wp-editor', @@ -320,17 +392,23 @@ function gutenberg_scripts_and_styles( $hook ) { true // enqueue in the footer. ); - // Load an actual post if an ID is specified. - $post_to_edit = null; + // Register `wp-utils` as a dependency of `word-count` to ensure that + // `wp-utils` doesn't clobbber `word-count`. See WordPress/gutenberg#1569. + $word_count_script = wp_scripts()->query( 'word-count' ); + array_push( $word_count_script->deps, 'wp-utils' ); + // Now load the `word-count` script from core. + wp_enqueue_script( 'word-count' ); + + $post_id = null; if ( isset( $_GET['post_id'] ) && (int) $_GET['post_id'] > 0 ) { - $request = new WP_REST_Request( - 'GET', - sprintf( '/wp/v2/posts/%d', (int) $_GET['post_id'] ) - ); - $request->set_param( 'context', 'edit' ); - $response = rest_do_request( $request ); - if ( 200 === $response->get_status() ) { - $post_to_edit = $response->get_data(); + $post_id = (int) $_GET['post_id']; + } + + $post_to_edit = null; + if ( $post_id ) { + $post_to_edit = gutenberg_get_post_to_edit( $post_id ); + if ( is_wp_error( $post_to_edit ) ) { + wp_die( $post_to_edit->get_error_message() ); } } @@ -348,7 +426,15 @@ function gutenberg_scripts_and_styles( $hook ) { file_get_contents( gutenberg_dir_path() . 'post-content.js' ) ); } else { - // TODO: Error handling. + // ...with a new empty post + // TODO: Error handling if we tried and failed to get a post above + $empty_post = array( + 'type' => 'post', + ); + wp_add_inline_script( + 'wp-editor', + 'window._wpGutenbergPost = ' . wp_json_encode( $empty_post ) . ';' + ); } // Prepare Jed locale data. @@ -360,7 +446,7 @@ function gutenberg_scripts_and_styles( $hook ) { ); // Initialize the editor. - wp_add_inline_script( 'wp-editor', 'wp.editor.createEditorInstance( \'editor\', window._wpGutenbergPost );' ); + wp_add_inline_script( 'wp-editor', 'wp.api.init().done( function() { wp.editor.createEditorInstance( \'editor\', window._wpGutenbergPost ); } );' ); /** * Styles @@ -373,8 +459,17 @@ function gutenberg_scripts_and_styles( $hook ) { wp_enqueue_style( 'wp-editor', gutenberg_url( 'editor/build/style.css' ), - array( 'wp-components', 'wp-blocks' ), + array( 'wp-components', 'wp-blocks', 'wp-edit-blocks' ), filemtime( gutenberg_dir_path() . 'editor/build/style.css' ) ); } add_action( 'admin_enqueue_scripts', 'gutenberg_scripts_and_styles' ); + +/** + * Handles the enqueueing of front end scripts and styles from Gutenberg. + */ +function gutenberg_frontend_scripts_and_styles() { + // Enqueue basic styles built out of Gutenberg through npm build. + wp_enqueue_style( 'wp-blocks' ); +} +add_action( 'wp_enqueue_scripts', 'gutenberg_frontend_scripts_and_styles' ); diff --git a/lib/parser.php b/lib/parser.php new file mode 100644 index 00000000000000..b135f0870852e2 --- /dev/null +++ b/lib/parser.php @@ -0,0 +1,1303 @@ +expected = $expected; + $this->found = $found; + $this->grammarOffset = $offset; + $this->grammarLine = $line; + $this->grammarColumn = $column; + $this->name = "Gutenberg_PEG_SyntaxError"; + } +};} + +class Gutenberg_PEG_Parser { + + + private $peg_currPos = 0; + private $peg_reportedPos = 0; + private $peg_cachedPos = 0; + private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false ); + private $peg_maxFailPos = 0; + private $peg_maxFailExpected = array(); + private $peg_silentFails = 0; + private $input = ""; + + + private function cleanup_state(){ + $this->peg_currPos = 0; + $this->peg_reportedPos = 0; + $this->peg_cachedPos = 0; + $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false ); + $this->peg_maxFailPos = 0; + $this->peg_maxFailExpected = array(); + $this->peg_silentFails = 0; + $this->input = ""; + + } + + + private function text() { + return substr($this->input, $this->peg_reportedPos, $this->peg_reportedPos + $this->peg_currPos); + } + + private function offset() { + return $this->peg_reportedPos; + } + + private function line() { + $compute_pd = $this->peg_computePosDetails($this->peg_reportedPos); + return $compute_pd["line"]; + } + + private function column() { + $compute_pd = $this->peg_computePosDetails($this->peg_reportedPos); + return $compute_pd["column"]; + } + + private function expected($description) { + throw $this->peg_buildException( + null, + array(array("type" => "other", "description" => $description )), + $this->peg_reportedPos + ); + } + + private function error($message) { + throw $this->peg_buildException($message, null, $this->peg_reportedPos); + } + + private function peg_advancePos(&$details, $startPos, $endPos) { + for ($p = $startPos; $p < $endPos; $p++) { + $ch = mb_substr($this->input, $p, 1, "UTF-8"); + if ($ch === "\n") { + if (!$details["seenCR"]) { $details["line"]++; } + $details["column"] = 1; + $details["seenCR"] = false; + } else if ($ch === "\r" || $ch === "\u2028" || $ch === "\u2029") { + $details["line"]++; + $details["column"] = 1; + $details["seenCR"] = true; + } else { + $details["column"]++; + $details["seenCR"] = false; + } + } + } + + private function peg_computePosDetails($pos) { + if ($this->peg_cachedPos !== $pos) { + if ($this->peg_cachedPos > $pos) { + $this->peg_cachedPos = 0; + $this->peg_cachedPosDetails = array( "line" => 1, "column" => 1, "seenCR" => false ); + } + $this->peg_advancePos($this->peg_cachedPosDetails, $this->peg_cachedPos, $pos); + $this->peg_cachedPos = $pos; + } + + return $this->peg_cachedPosDetails; + } + + private function peg_fail($expected) { + if ($this->peg_currPos < $this->peg_maxFailPos) { return; } + + if ($this->peg_currPos > $this->peg_maxFailPos) { + $this->peg_maxFailPos = $this->peg_currPos; + $this->peg_maxFailExpected = array(); + } + + $this->peg_maxFailExpected[] = $expected; + } + + private function peg_buildException_expectedComparator($a, $b) { + if ($a["description"] < $b["description"]) { + return -1; + } else if ($a["description"] > $b["description"]) { + return 1; + } else { + return 0; + } + } + + private function peg_buildException($message, $expected, $pos) { + $posDetails = $this->peg_computePosDetails($pos); + $found = $pos < mb_strlen($this->input, "UTF-8") ? mb_substr($this->input, $pos, 1, "UTF-8") : null; + + if ($expected !== null) { + usort($expected, array($this, "peg_buildException_expectedComparator")); + $i = 1; + while ($i < count($expected)) { + if ($expected[$i - 1] === $expected[$i]) { + array_splice($expected, $i, 1); + } else { + $i++; + } + } + } + + if ($message === null) { + $expectedDescs = array_fill(0, count($expected), null); + + for ($i = 0; $i < count($expected); $i++) { + $expectedDescs[$i] = $expected[$i]["description"]; + } + + $expectedDesc = count($expected) > 1 + ? join(", ", array_slice($expectedDescs, 0, -1)) + . " or " + . $expectedDescs[count($expected) - 1] + : $expectedDescs[0]; + + $foundDesc = $found ? json_encode($found) : "end of input"; + + $message = "Expected " . $expectedDesc . " but " . $foundDesc . " found."; + } + + return new Gutenberg_PEG_SyntaxError( + $message, + $expected, + $found, + $pos, + $posDetails["line"], + $posDetails["column"] + ); + } + + private $peg_FAILED; + private $peg_c0; + private $peg_c1; + private $peg_c2; + private $peg_c3; + private $peg_c4; + private $peg_c5; + private $peg_c6; + private $peg_c7; + private $peg_c8; + private $peg_c9; + private $peg_c10; + private $peg_c11; + private $peg_c12; + private $peg_c13; + private $peg_c14; + private $peg_c15; + private $peg_c16; + private $peg_c17; + private $peg_c18; + private $peg_c19; + private $peg_c20; + private $peg_c21; + private $peg_c22; + private $peg_c23; + private $peg_c24; + private $peg_c25; + private $peg_c26; + private $peg_c27; + private $peg_c28; + private $peg_c29; + + private function peg_f0($blockName, $a) { return $a; } + private function peg_f1($blockName, $attrs) { + return array( + 'blockName' => $blockName, + 'attrs' => $attrs, + 'rawContent' => '', + ); + } + private function peg_f2($s, $c) { return $c; } + private function peg_f3($s, $ts, $e) { return $s['blockName'] === $e['blockName']; } + private function peg_f4($s, $ts, $e) { + return array( + 'blockName' => $s['blockName'], + 'attrs' => $s['attrs'], + 'rawContent' => implode( '', $ts ), + ); + } + private function peg_f5($c) { return $c; } + private function peg_f6($ts) { + return array( + 'attrs' => array(), + 'rawContent' => implode( '', $ts ), + ); + } + private function peg_f7($blockName, $attrs) { + return array( + 'blockName' => $blockName, + 'attrs' => $attrs, + ); + } + private function peg_f8($blockName) { + return array( + 'blockName' => $blockName, + ); + } + private function peg_f9($attrs) { return json_decode( $attrs, true ); } + + private function peg_parseDocument() { + + $s0 = $this->peg_parseWP_Block_List(); + + return $s0; + } + + private function peg_parseWP_Block_List() { + + $s0 = array(); + $s1 = $this->peg_parseWP_Block(); + while ($s1 !== $this->peg_FAILED) { + $s0[] = $s1; + $s1 = $this->peg_parseWP_Block(); + } + + return $s0; + } + + private function peg_parseWP_Block() { + + $s0 = $this->peg_parseWP_Block_Void(); + if ($s0 === $this->peg_FAILED) { + $s0 = $this->peg_parseWP_Block_Balanced(); + if ($s0 === $this->peg_FAILED) { + $s0 = $this->peg_parseWP_Block_Html(); + } + } + + return $s0; + } + + private function peg_parseWP_Block_Void() { + + $s0 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 4, "UTF-8") === $this->peg_c0) { + $s1 = $this->peg_c0; + $this->peg_currPos += 4; + } else { + $s1 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c1); } + } + if ($s1 !== $this->peg_FAILED) { + $s2 = array(); + $s3 = $this->peg_parseWS(); + if ($s3 !== $this->peg_FAILED) { + while ($s3 !== $this->peg_FAILED) { + $s2[] = $s3; + $s3 = $this->peg_parseWS(); + } + } else { + $s2 = $this->peg_FAILED; + } + if ($s2 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 3, "UTF-8") === $this->peg_c2) { + $s3 = $this->peg_c2; + $this->peg_currPos += 3; + } else { + $s3 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c3); } + } + if ($s3 !== $this->peg_FAILED) { + $s4 = $this->peg_parseWP_Block_Name(); + if ($s4 !== $this->peg_FAILED) { + $s5 = array(); + $s6 = $this->peg_parseWS(); + if ($s6 !== $this->peg_FAILED) { + while ($s6 !== $this->peg_FAILED) { + $s5[] = $s6; + $s6 = $this->peg_parseWS(); + } + } else { + $s5 = $this->peg_FAILED; + } + if ($s5 !== $this->peg_FAILED) { + $s6 = $this->peg_currPos; + $s7 = $this->peg_parseWP_Block_Attributes(); + if ($s7 !== $this->peg_FAILED) { + $s8 = array(); + $s9 = $this->peg_parseWS(); + if ($s9 !== $this->peg_FAILED) { + while ($s9 !== $this->peg_FAILED) { + $s8[] = $s9; + $s9 = $this->peg_parseWS(); + } + } else { + $s8 = $this->peg_FAILED; + } + if ($s8 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s6; + $s7 = $this->peg_f0($s4, $s7); + $s6 = $s7; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 === $this->peg_FAILED) { + $s6 = null; + } + if ($s6 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 4, "UTF-8") === $this->peg_c4) { + $s7 = $this->peg_c4; + $this->peg_currPos += 4; + } else { + $s7 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c5); } + } + if ($s7 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s0; + $s1 = $this->peg_f1($s4, $s6); + $s0 = $s1; + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + + return $s0; + } + + private function peg_parseWP_Block_Balanced() { + + $s0 = $this->peg_currPos; + $s1 = $this->peg_parseWP_Block_Start(); + if ($s1 !== $this->peg_FAILED) { + $s2 = array(); + $s3 = $this->peg_currPos; + $s4 = $this->peg_currPos; + $this->peg_silentFails++; + $s5 = $this->peg_parseWP_Block_End(); + $this->peg_silentFails--; + if ($s5 === $this->peg_FAILED) { + $s4 = null; + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + if ($s4 !== $this->peg_FAILED) { + $s5 = $this->peg_parseAny(); + if ($s5 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s3; + $s4 = $this->peg_f2($s1, $s5); + $s3 = $s4; + } else { + $this->peg_currPos = $s3; + $s3 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s3; + $s3 = $this->peg_FAILED; + } + while ($s3 !== $this->peg_FAILED) { + $s2[] = $s3; + $s3 = $this->peg_currPos; + $s4 = $this->peg_currPos; + $this->peg_silentFails++; + $s5 = $this->peg_parseWP_Block_End(); + $this->peg_silentFails--; + if ($s5 === $this->peg_FAILED) { + $s4 = null; + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + if ($s4 !== $this->peg_FAILED) { + $s5 = $this->peg_parseAny(); + if ($s5 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s3; + $s4 = $this->peg_f2($s1, $s5); + $s3 = $s4; + } else { + $this->peg_currPos = $s3; + $s3 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s3; + $s3 = $this->peg_FAILED; + } + } + if ($s2 !== $this->peg_FAILED) { + $s3 = $this->peg_parseWP_Block_End(); + if ($s3 !== $this->peg_FAILED) { + $this->peg_reportedPos = $this->peg_currPos; + $s4 = $this->peg_f3($s1, $s2, $s3); + if ($s4) { + $s4 = null; + } else { + $s4 = $this->peg_FAILED; + } + if ($s4 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s0; + $s1 = $this->peg_f4($s1, $s2, $s3); + $s0 = $s1; + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + + return $s0; + } + + private function peg_parseWP_Block_Html() { + + $s0 = $this->peg_currPos; + $s1 = array(); + $s2 = $this->peg_currPos; + $s3 = $this->peg_currPos; + $this->peg_silentFails++; + $s4 = $this->peg_parseWP_Block_Balanced(); + $this->peg_silentFails--; + if ($s4 === $this->peg_FAILED) { + $s3 = null; + } else { + $this->peg_currPos = $s3; + $s3 = $this->peg_FAILED; + } + if ($s3 !== $this->peg_FAILED) { + $s4 = $this->peg_currPos; + $this->peg_silentFails++; + $s5 = $this->peg_parseWP_Block_Void(); + $this->peg_silentFails--; + if ($s5 === $this->peg_FAILED) { + $s4 = null; + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + if ($s4 !== $this->peg_FAILED) { + $s5 = $this->peg_parseAny(); + if ($s5 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s2; + $s3 = $this->peg_f5($s5); + $s2 = $s3; + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + if ($s2 !== $this->peg_FAILED) { + while ($s2 !== $this->peg_FAILED) { + $s1[] = $s2; + $s2 = $this->peg_currPos; + $s3 = $this->peg_currPos; + $this->peg_silentFails++; + $s4 = $this->peg_parseWP_Block_Balanced(); + $this->peg_silentFails--; + if ($s4 === $this->peg_FAILED) { + $s3 = null; + } else { + $this->peg_currPos = $s3; + $s3 = $this->peg_FAILED; + } + if ($s3 !== $this->peg_FAILED) { + $s4 = $this->peg_currPos; + $this->peg_silentFails++; + $s5 = $this->peg_parseWP_Block_Void(); + $this->peg_silentFails--; + if ($s5 === $this->peg_FAILED) { + $s4 = null; + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + if ($s4 !== $this->peg_FAILED) { + $s5 = $this->peg_parseAny(); + if ($s5 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s2; + $s3 = $this->peg_f5($s5); + $s2 = $s3; + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } + } else { + $s1 = $this->peg_FAILED; + } + if ($s1 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s0; + $s1 = $this->peg_f6($s1); + } + $s0 = $s1; + + return $s0; + } + + private function peg_parseWP_Block_Start() { + + $s0 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 4, "UTF-8") === $this->peg_c0) { + $s1 = $this->peg_c0; + $this->peg_currPos += 4; + } else { + $s1 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c1); } + } + if ($s1 !== $this->peg_FAILED) { + $s2 = array(); + $s3 = $this->peg_parseWS(); + if ($s3 !== $this->peg_FAILED) { + while ($s3 !== $this->peg_FAILED) { + $s2[] = $s3; + $s3 = $this->peg_parseWS(); + } + } else { + $s2 = $this->peg_FAILED; + } + if ($s2 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 3, "UTF-8") === $this->peg_c2) { + $s3 = $this->peg_c2; + $this->peg_currPos += 3; + } else { + $s3 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c3); } + } + if ($s3 !== $this->peg_FAILED) { + $s4 = $this->peg_parseWP_Block_Name(); + if ($s4 !== $this->peg_FAILED) { + $s5 = array(); + $s6 = $this->peg_parseWS(); + if ($s6 !== $this->peg_FAILED) { + while ($s6 !== $this->peg_FAILED) { + $s5[] = $s6; + $s6 = $this->peg_parseWS(); + } + } else { + $s5 = $this->peg_FAILED; + } + if ($s5 !== $this->peg_FAILED) { + $s6 = $this->peg_currPos; + $s7 = $this->peg_parseWP_Block_Attributes(); + if ($s7 !== $this->peg_FAILED) { + $s8 = array(); + $s9 = $this->peg_parseWS(); + if ($s9 !== $this->peg_FAILED) { + while ($s9 !== $this->peg_FAILED) { + $s8[] = $s9; + $s9 = $this->peg_parseWS(); + } + } else { + $s8 = $this->peg_FAILED; + } + if ($s8 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s6; + $s7 = $this->peg_f0($s4, $s7); + $s6 = $s7; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 === $this->peg_FAILED) { + $s6 = null; + } + if ($s6 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 3, "UTF-8") === $this->peg_c6) { + $s7 = $this->peg_c6; + $this->peg_currPos += 3; + } else { + $s7 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c7); } + } + if ($s7 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s0; + $s1 = $this->peg_f7($s4, $s6); + $s0 = $s1; + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + + return $s0; + } + + private function peg_parseWP_Block_End() { + + $s0 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 4, "UTF-8") === $this->peg_c0) { + $s1 = $this->peg_c0; + $this->peg_currPos += 4; + } else { + $s1 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c1); } + } + if ($s1 !== $this->peg_FAILED) { + $s2 = array(); + $s3 = $this->peg_parseWS(); + if ($s3 !== $this->peg_FAILED) { + while ($s3 !== $this->peg_FAILED) { + $s2[] = $s3; + $s3 = $this->peg_parseWS(); + } + } else { + $s2 = $this->peg_FAILED; + } + if ($s2 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 4, "UTF-8") === $this->peg_c8) { + $s3 = $this->peg_c8; + $this->peg_currPos += 4; + } else { + $s3 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c9); } + } + if ($s3 !== $this->peg_FAILED) { + $s4 = $this->peg_parseWP_Block_Name(); + if ($s4 !== $this->peg_FAILED) { + $s5 = array(); + $s6 = $this->peg_parseWS(); + if ($s6 !== $this->peg_FAILED) { + while ($s6 !== $this->peg_FAILED) { + $s5[] = $s6; + $s6 = $this->peg_parseWS(); + } + } else { + $s5 = $this->peg_FAILED; + } + if ($s5 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 3, "UTF-8") === $this->peg_c6) { + $s6 = $this->peg_c6; + $this->peg_currPos += 3; + } else { + $s6 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c7); } + } + if ($s6 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s0; + $s1 = $this->peg_f8($s4); + $s0 = $s1; + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s0; + $s0 = $this->peg_FAILED; + } + + return $s0; + } + + private function peg_parseWP_Block_Name() { + + $s0 = $this->peg_currPos; + $s1 = $this->peg_currPos; + $s2 = $this->peg_parseASCII_Letter(); + if ($s2 !== $this->peg_FAILED) { + $s3 = array(); + $s4 = $this->peg_parseASCII_AlphaNumeric(); + if ($s4 === $this->peg_FAILED) { + $s4 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c10) { + $s5 = $this->peg_c10; + $this->peg_currPos++; + } else { + $s5 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c11); } + } + if ($s5 !== $this->peg_FAILED) { + $s6 = $this->peg_parseASCII_AlphaNumeric(); + if ($s6 !== $this->peg_FAILED) { + $s5 = array($s5, $s6); + $s4 = $s5; + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + } + while ($s4 !== $this->peg_FAILED) { + $s3[] = $s4; + $s4 = $this->peg_parseASCII_AlphaNumeric(); + if ($s4 === $this->peg_FAILED) { + $s4 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c10) { + $s5 = $this->peg_c10; + $this->peg_currPos++; + } else { + $s5 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c11); } + } + if ($s5 !== $this->peg_FAILED) { + $s6 = $this->peg_parseASCII_AlphaNumeric(); + if ($s6 !== $this->peg_FAILED) { + $s5 = array($s5, $s6); + $s4 = $s5; + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s4; + $s4 = $this->peg_FAILED; + } + } + } + if ($s3 !== $this->peg_FAILED) { + $s2 = array($s2, $s3); + $s1 = $s2; + } else { + $this->peg_currPos = $s1; + $s1 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s1; + $s1 = $this->peg_FAILED; + } + if ($s1 !== $this->peg_FAILED) { + $s0 = mb_substr($this->input, $s0, $this->peg_currPos - $s0, "UTF-8"); + } else { + $s0 = $s1; + } + + return $s0; + } + + private function peg_parseWP_Block_Attributes() { + + $s0 = $this->peg_currPos; + $s1 = $this->peg_currPos; + $s2 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c12) { + $s3 = $this->peg_c12; + $this->peg_currPos++; + } else { + $s3 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c13); } + } + if ($s3 !== $this->peg_FAILED) { + $s4 = array(); + $s5 = $this->peg_currPos; + $s6 = $this->peg_currPos; + $this->peg_silentFails++; + $s7 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c14) { + $s8 = $this->peg_c14; + $this->peg_currPos++; + } else { + $s8 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c15); } + } + if ($s8 !== $this->peg_FAILED) { + $s9 = array(); + $s10 = $this->peg_parseWS(); + if ($s10 !== $this->peg_FAILED) { + while ($s10 !== $this->peg_FAILED) { + $s9[] = $s10; + $s10 = $this->peg_parseWS(); + } + } else { + $s9 = $this->peg_FAILED; + } + if ($s9 !== $this->peg_FAILED) { + $s10 = $this->peg_c16; + if ($s10 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c10) { + $s11 = $this->peg_c10; + $this->peg_currPos++; + } else { + $s11 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c11); } + } + if ($s11 === $this->peg_FAILED) { + $s11 = null; + } + if ($s11 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 3, "UTF-8") === $this->peg_c6) { + $s12 = $this->peg_c6; + $this->peg_currPos += 3; + } else { + $s12 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c7); } + } + if ($s12 !== $this->peg_FAILED) { + $s8 = array($s8, $s9, $s10, $s11, $s12); + $s7 = $s8; + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + $this->peg_silentFails--; + if ($s7 === $this->peg_FAILED) { + $s6 = null; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 !== $this->peg_FAILED) { + if (mb_strlen($this->input, "UTF-8") > $this->peg_currPos) { + $s7 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s7 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c17); } + } + if ($s7 !== $this->peg_FAILED) { + $s6 = array($s6, $s7); + $s5 = $s6; + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + while ($s5 !== $this->peg_FAILED) { + $s4[] = $s5; + $s5 = $this->peg_currPos; + $s6 = $this->peg_currPos; + $this->peg_silentFails++; + $s7 = $this->peg_currPos; + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c14) { + $s8 = $this->peg_c14; + $this->peg_currPos++; + } else { + $s8 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c15); } + } + if ($s8 !== $this->peg_FAILED) { + $s9 = array(); + $s10 = $this->peg_parseWS(); + if ($s10 !== $this->peg_FAILED) { + while ($s10 !== $this->peg_FAILED) { + $s9[] = $s10; + $s10 = $this->peg_parseWS(); + } + } else { + $s9 = $this->peg_FAILED; + } + if ($s9 !== $this->peg_FAILED) { + $s10 = $this->peg_c16; + if ($s10 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c10) { + $s11 = $this->peg_c10; + $this->peg_currPos++; + } else { + $s11 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c11); } + } + if ($s11 === $this->peg_FAILED) { + $s11 = null; + } + if ($s11 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 3, "UTF-8") === $this->peg_c6) { + $s12 = $this->peg_c6; + $this->peg_currPos += 3; + } else { + $s12 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c7); } + } + if ($s12 !== $this->peg_FAILED) { + $s8 = array($s8, $s9, $s10, $s11, $s12); + $s7 = $s8; + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + $this->peg_silentFails--; + if ($s7 === $this->peg_FAILED) { + $s6 = null; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 !== $this->peg_FAILED) { + if (mb_strlen($this->input, "UTF-8") > $this->peg_currPos) { + $s7 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s7 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c17); } + } + if ($s7 !== $this->peg_FAILED) { + $s6 = array($s6, $s7); + $s5 = $s6; + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } + if ($s4 !== $this->peg_FAILED) { + if (mb_substr($this->input, $this->peg_currPos, 1, "UTF-8") === $this->peg_c14) { + $s5 = $this->peg_c14; + $this->peg_currPos++; + } else { + $s5 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c15); } + } + if ($s5 !== $this->peg_FAILED) { + $s3 = array($s3, $s4, $s5); + $s2 = $s3; + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s2; + $s2 = $this->peg_FAILED; + } + if ($s2 !== $this->peg_FAILED) { + $s1 = mb_substr($this->input, $s1, $this->peg_currPos - $s1, "UTF-8"); + } else { + $s1 = $s2; + } + if ($s1 !== $this->peg_FAILED) { + $this->peg_reportedPos = $s0; + $s1 = $this->peg_f9($s1); + } + $s0 = $s1; + + return $s0; + } + + private function peg_parseASCII_AlphaNumeric() { + + $s0 = $this->peg_parseASCII_Letter(); + if ($s0 === $this->peg_FAILED) { + $s0 = $this->peg_parseASCII_Digit(); + if ($s0 === $this->peg_FAILED) { + $s0 = $this->peg_parseSpecial_Chars(); + } + } + + return $s0; + } + + private function peg_parseASCII_Letter() { + + if (Gutenberg_PEG_peg_regex_test($this->peg_c18, mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"))) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c19); } + } + + return $s0; + } + + private function peg_parseASCII_Digit() { + + if (Gutenberg_PEG_peg_regex_test($this->peg_c20, mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"))) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c21); } + } + + return $s0; + } + + private function peg_parseSpecial_Chars() { + + if (Gutenberg_PEG_peg_regex_test($this->peg_c22, mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"))) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c23); } + } + + return $s0; + } + + private function peg_parseWS() { + + if (Gutenberg_PEG_peg_regex_test($this->peg_c24, mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"))) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c25); } + } + + return $s0; + } + + private function peg_parseNewline() { + + if (Gutenberg_PEG_peg_regex_test($this->peg_c26, mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"))) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c27); } + } + + return $s0; + } + + private function peg_parse_() { + + if (Gutenberg_PEG_peg_regex_test($this->peg_c28, mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"))) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c29); } + } + + return $s0; + } + + private function peg_parse__() { + + $s0 = array(); + $s1 = $this->peg_parse_(); + if ($s1 !== $this->peg_FAILED) { + while ($s1 !== $this->peg_FAILED) { + $s0[] = $s1; + $s1 = $this->peg_parse_(); + } + } else { + $s0 = $this->peg_FAILED; + } + + return $s0; + } + + private function peg_parseAny() { + + if (mb_strlen($this->input, "UTF-8") > $this->peg_currPos) { + $s0 = mb_substr($this->input, $this->peg_currPos, 1, "UTF-8"); + $this->peg_currPos++; + } else { + $s0 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { $this->peg_fail($this->peg_c17); } + } + + return $s0; + } + + public function parse($input) { + $arguments = func_get_args(); + $options = count($arguments) > 1 ? $arguments[1] : array(); + $this->cleanup_state(); + $this->input = $input; + $old_regex_encoding = mb_regex_encoding(); + mb_regex_encoding("UTF-8"); + + $this->peg_FAILED = new stdClass; + $this->peg_c0 = ""; + $this->peg_c5 = array( "type" => "literal", "value" => "/-->", "description" => "\"/-->\"" ); + $this->peg_c6 = "-->"; + $this->peg_c7 = array( "type" => "literal", "value" => "-->", "description" => "\"-->\"" ); + $this->peg_c8 = "/wp:"; + $this->peg_c9 = array( "type" => "literal", "value" => "/wp:", "description" => "\"/wp:\"" ); + $this->peg_c10 = "/"; + $this->peg_c11 = array( "type" => "literal", "value" => "/", "description" => "\"/\"" ); + $this->peg_c12 = "{"; + $this->peg_c13 = array( "type" => "literal", "value" => "{", "description" => "\"{\"" ); + $this->peg_c14 = "}"; + $this->peg_c15 = array( "type" => "literal", "value" => "}", "description" => "\"}\"" ); + $this->peg_c16 = ""; + $this->peg_c17 = array("type" => "any", "description" => "any character" ); + $this->peg_c18 = "/^[a-zA-Z]/"; + $this->peg_c19 = array( "type" => "class", "value" => "[a-zA-Z]", "description" => "[a-zA-Z]" ); + $this->peg_c20 = "/^[0-9]/"; + $this->peg_c21 = array( "type" => "class", "value" => "[0-9]", "description" => "[0-9]" ); + $this->peg_c22 = "/^[-_]/"; + $this->peg_c23 = array( "type" => "class", "value" => "[-_]", "description" => "[-_]" ); + $this->peg_c24 = "/^[ \\t\\r\\n]/"; + $this->peg_c25 = array( "type" => "class", "value" => "[ \t\r\n]", "description" => "[ \t\r\n]" ); + $this->peg_c26 = "/^[\\r\\n]/"; + $this->peg_c27 = array( "type" => "class", "value" => "[\r\n]", "description" => "[\r\n]" ); + $this->peg_c28 = "/^[ \\t]/"; + $this->peg_c29 = array( "type" => "class", "value" => "[ \t]", "description" => "[ \t]" ); + + $peg_startRuleFunctions = array( 'Document' => array($this, "peg_parseDocument") ); + $peg_startRuleFunction = array($this, "peg_parseDocument"); + if (isset($options["startRule"])) { + if (!(isset($peg_startRuleFunctions[$options["startRule"]]))) { + throw new Exception("Can't start parsing from rule \"" + $options["startRule"] + "\"."); + } + + $peg_startRuleFunction = $peg_startRuleFunctions[$options["startRule"]]; + } + + /* BEGIN initializer code */ + + // The `maybeJSON` function is not needed in PHP because its return semantics + // are the same as `json_decode` + + /* END initializer code */ + + $peg_result = call_user_func($peg_startRuleFunction); + + mb_regex_encoding($old_regex_encoding); + if ($peg_result !== $this->peg_FAILED && $this->peg_currPos === mb_strlen($input, "UTF-8")) { + return $peg_result; + } else { + if ($peg_result !== $this->peg_FAILED && $this->peg_currPos < mb_strlen($input, "UTF-8")) { + $this->peg_fail(array("type" => "end", "description" => "end of input" )); + } + + throw $this->peg_buildException(null, $this->peg_maxFailExpected, $this->peg_maxFailPos); + } + } + +}; \ No newline at end of file diff --git a/package.json b/package.json index 2b63e2e7f842d5..f8eb2be5e3658c 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "lodash": "^4.17.4", "moment": "^2.18.1", "moment-timezone": "^0.5.13", + "pegjs": "0.10.0", + "phpegjs": "1.0.0-beta3", "react": "^15.5.4", "react-autosize-textarea": "^0.4.2", "react-click-outside": "^2.3.0", diff --git a/phpcs.xml b/phpcs.xml index d6499cd9017e1b..bc8bf43defd5ba 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -9,8 +9,8 @@ gutenberg.php -index.php ./lib +./lib/parser.php ./phpunit ./bin @@ -24,6 +24,11 @@gutenberg.php + ++ +* +phpunit/* @@ -40,4 +45,10 @@+ phpunit/* + +phpunit/* ++ diff --git a/phpunit/class-block-type-registry-test.php b/phpunit/class-block-type-registry-test.php index 375f87d08d4d2f..4fca2c54eb6f60 100644 --- a/phpunit/class-block-type-registry-test.php +++ b/phpunit/class-block-type-registry-test.php @@ -54,7 +54,7 @@ function test_invalid_names_without_namespace() { * * @expectedIncorrectUsage WP_Block_Type_Registry::register */ - function test_invlalid_characters() { + function test_invalid_characters() { $result = $this->registry->register( 'still/_doing_it_wrong', array() ); $this->assertFalse( $result ); } diff --git a/phpunit/class-dynamic-blocks-render-test.php b/phpunit/class-dynamic-blocks-render-test.php index 8bb0a0e2f3c3d4..0d104bfd2c7b12 100644 --- a/phpunit/class-dynamic-blocks-render-test.php +++ b/phpunit/class-dynamic-blocks-render-test.php @@ -59,11 +59,11 @@ function test_dynamic_block_rendering() { // The duplicated dynamic blocks below are there to ensure that do_blocks() replaces each one-by-one. $post_content = 'before' . - '' . - '' . + '' . + '' . 'between' . - '' . - '' . + '' . + '' . 'after'; $updated_post_content = do_blocks( $post_content ); @@ -93,9 +93,9 @@ function test_dynamic_block_rendering_with_content() { register_block_type( 'core/dummy', $settings ); $post_content = 'before' . - "this\nshould\n\nbe\nignored" . + 'this\nshould\n\nbe\nignored' . 'between' . - 'this should also be ignored' . + 'this should also be ignored' . 'after'; $updated_post_content = do_blocks( $post_content ); diff --git a/phpunit/class-parsing-test.php b/phpunit/class-parsing-test.php new file mode 100644 index 00000000000000..7c5be8c014647c --- /dev/null +++ b/phpunit/class-parsing-test.php @@ -0,0 +1,62 @@ +parse( $html ); + + $this->assertEquals( $expected_parsed, $result ); + } +} diff --git a/post-content.js b/post-content.js index edd015da599278..cbb2779b839842 100644 --- a/post-content.js +++ b/post-content.js @@ -2,12 +2,17 @@ * Temporary test post content */ window._wpGutenbergPost = { + type: 'post', title: { raw: 'Welcome to the Gutenberg Editor', }, content: { raw: [ - '', + '', + 'phpunit/* +', + '', + + '', ' Of mountains & printing presses
The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is composed of pieces of content—somewhat similar to LEGO bricks—that you can move around and interact with. Move your cursor around and you\'ll notice the different blocks light up with outlines and arrows. Press the arrows to reposition blocks quickly, without fearing about losing things in the process of copying and pasting.
', '', @@ -15,7 +20,7 @@ window._wpGutenbergPost = { 'What you are reading now is a text block, the most basic block of all. The text block has its own controls to be moved freely around the post...
', '', - '', + '', '... like this one, which is right aligned.
', '', @@ -30,11 +35,11 @@ window._wpGutenbergPost = { '', '', - 'Handling images and media with the utmost care is a primary focus of the new editor. Hopefully you\'ll find aspects like adding captions or going full-width with your pictures much easier and robust than before.
', + 'Handling images and media with the utmost care is a primary focus of the new editor. Hopefully, you\'ll find aspects of adding captions or going full-width with your pictures much easier and robust than before.
', '', - '', - '', + '', + ' Give it a try. Press the "really wide" button on the image toolbar. ', '', '', @@ -61,12 +66,12 @@ window._wpGutenbergPost = { ' Give it a try. Press the "really wide" button on the image toolbar. If you want to learn more about how to build additional blocks, or if you are interested in helping with the project, head over to the GitHub repository.
', '', - '', - '', + '', + ' ', '', '', - '
', + '
', '', '', @@ -74,11 +79,11 @@ window._wpGutenbergPost = { '', '', - 'A huge benefit of blocks is that you can edit them in place and manipulate you content directly. Instead of having fields for editing things like the source of a quote, or the text of a button, you can directly change the content. Try editing the following quote:
', + 'A huge benefit of blocks is that you can edit them in place and manipulate your content directly. Instead of having fields for editing things like the source of a quote, or the text of a button, you can directly change the content. Try editing the following quote:
', '', - '', - '', + '', + '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.
', '', '', @@ -89,12 +94,12 @@ window._wpGutenbergPost = { '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.
Blocks can be anything you need. For instance, you may want to insert a subdued quote as part of the composition of your text, or you may prefer to display a giant stylized one. All of these options are available in the inserter.
', '', - '', - '', + '', + 'There is no greater agony than bearing an untold story inside you.
', '', '', - 'There is no greater agony than bearing an untold story inside you.
', + '
', '', '', @@ -105,8 +110,8 @@ window._wpGutenbergPost = { 'Ea veniam homero eam. Ex inimicus molestiae cum, debet scaevola at eos. Vis assum veritus ut, has ea nostrud accusata, offendit appareat comprehensam ea pro. Ad quo quem veritus appellantur, te est quas phaedrum, eum alia habeo ad. Ei est erroribus imperdiet, omnis dicam propriae sed no. His vitae oratio fierent ne, cu duo tota eligendi, electram rationibus in qui.
', '', - '', - '', + '', + ' ', '', '', @@ -118,21 +123,20 @@ window._wpGutenbergPost = { '', '', - ' export default function MyButton() {\n\ + '
', '', - '', - 'export default function MyButton() {\n\ return <Button>Click Me!</Button>;\n\ }
', - '', - - '', - ' ', - '', + '', + ' ', + '', + '', '', - '', + ' ', + ' An old silent pond...', + '
A frog jumps into the pond,
splash! Silence again.An old silent pond...', '', '', @@ -148,30 +152,30 @@ window._wpGutenbergPost = { '', '', - '
A frog jumps into the pond,
splash! Silence again.', + 'Code is Poetry
', '', '', - 'Code is Poetry
', + '
', '', '', - '', + '
Version Musician Date 4.4 Clifford Brown December 8, 2015 4.5 Coleman Hawkins April 12, 2016 4.6 Pepper Adams August 16, 2016 4.7 Sarah Vaughan December 6, 2016 ', '', '', '
Version Musician Date 4.4 Clifford Brown December 8, 2015 4.5 Coleman Hawkins April 12, 2016 4.6 Pepper Adams August 16, 2016 4.7 Sarah Vaughan December 6, 2016 All that you can embed!
', '', - '', - 'https://www.youtube.com/watch?v=Nl6U7UotA-M ', + '', + 'State of the Word 2016 https://www.youtube.com/watch?v=Nl6U7UotA-M ', '', - '', + '', 'https://twitter.com/photomatt/status/868657763970404352', '', - '', + '', 'https://make.wordpress.org/core/2017/01/17/editor-technical-overview/', '', diff --git a/utils/keycodes.js b/utils/keycodes.js index f7f3b6cfe2db86..3363e4f1ade462 100644 --- a/utils/keycodes.js +++ b/utils/keycodes.js @@ -7,3 +7,4 @@ export const UP = 38; export const RIGHT = 39; export const DOWN = 40; export const DELETE = 46; +export const CHAR_A = 'A'.charCodeAt( 0 ); diff --git a/webpack.config.js b/webpack.config.js index c20462f582084c..2648adc0bd2481 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,6 +6,38 @@ const glob = require( 'glob' ); const webpack = require( 'webpack' ); const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); +// Main CSS loader for everything but blocks.. +const mainCSSExtractTextPlugin = new ExtractTextPlugin( { + filename: './[name]/build/style.css', +} ); + +// CSS loader for styles specific to block editing. +const editBlocksCSSPlugin = new ExtractTextPlugin( { + filename: './blocks/build/edit-blocks.css', +} ); + +// CSS loader for styles specific to blocks in general. +const blocksCSSPlugin = new ExtractTextPlugin( { + filename: './blocks/build/style.css', +} ); + +// Configuration for the ExtractTextPlugin. +const extractConfig = { + use: [ + { loader: 'raw-loader' }, + { loader: 'postcss-loader' }, + { + loader: 'sass-loader', + query: { + includePaths: [ 'editor/assets/stylesheets' ], + data: '@import "variables"; @import "mixins"; @import "animations";@import "z-index";', + outputStyle: 'production' === process.env.NODE_ENV ? + 'compressed' : 'nested', + }, + }, + ], +}; + const entryPointNames = [ 'element', 'i18n', @@ -64,23 +96,29 @@ const config = { exclude: /node_modules/, use: 'babel-loader', }, + { + test: /block\.s?css$/, + include: [ + /blocks/, + ], + use: blocksCSSPlugin.extract( extractConfig ), + }, + { + test: /\.s?css$/, + include: [ + /blocks/, + ], + exclude: [ + /block\.s?css$/, + ], + use: editBlocksCSSPlugin.extract( extractConfig ), + }, { test: /\.s?css$/, - use: ExtractTextPlugin.extract( { - use: [ - { loader: 'raw-loader' }, - { loader: 'postcss-loader' }, - { - loader: 'sass-loader', - query: { - includePaths: [ 'editor/assets/stylesheets' ], - data: '@import "variables"; @import "mixins"; @import "animations";@import "z-index";', - outputStyle: 'production' === process.env.NODE_ENV ? - 'compressed' : 'nested', - }, - }, - ], - } ), + exclude: [ + /blocks/, + ], + use: mainCSSExtractTextPlugin.extract( extractConfig ), }, ], }, @@ -88,9 +126,9 @@ const config = { new webpack.DefinePlugin( { 'process.env.NODE_ENV': JSON.stringify( process.env.NODE_ENV || 'development' ), } ), - new ExtractTextPlugin( { - filename: './[name]/build/style.css', - } ), + blocksCSSPlugin, + editBlocksCSSPlugin, + mainCSSExtractTextPlugin, new webpack.LoaderOptionsPlugin( { minimize: process.env.NODE_ENV === 'production', debug: process.env.NODE_ENV !== 'production',State of the Word 2016