diff --git a/lib/parser.php b/lib/parser.php index 330249196861a0..85ca8213c3e60b 100644 --- a/lib/parser.php +++ b/lib/parser.php @@ -259,20 +259,22 @@ private function peg_f1($pre, $bs, $post) { return peg_join_blocks( $pre, $bs, $ private function peg_f2($blockName, $a) { return $a; } private function peg_f3($blockName, $attrs) { return array( - 'blockName' => $blockName, - 'attrs' => isset( $attrs ) ? $attrs : array(), - 'innerBlocks' => array(), - 'innerHTML' => '', + 'blockName' => $blockName, + 'attrs' => isset( $attrs ) ? $attrs : array(), + 'innerBlocks' => array(), + 'innerHTML' => '', + 'innerContent' => array(), ); } private function peg_f4($s, $children, $e) { - list( $innerHTML, $innerBlocks ) = peg_array_partition( $children, 'is_string' ); + list( $innerHTML, $innerBlocks, $innerContent ) = peg_process_inner_content( $children ); return array( 'blockName' => $s['blockName'], 'attrs' => $s['attrs'], 'innerBlocks' => $innerBlocks, - 'innerHTML' => implode( '', $innerHTML ), + 'innerHTML' => $innerHTML, + 'innerContent' => $innerContent, ); } private function peg_f5($blockName, $attrs) { @@ -711,36 +713,106 @@ private function peg_parseBlock_Balanced() { $s3 = $this->peg_parseBlock(); if ($s3 === $this->peg_FAILED) { $s3 = $this->peg_currPos; - $s4 = $this->peg_currPos; + $s4 = array(); $s5 = $this->peg_currPos; + $s6 = $this->peg_currPos; $this->peg_silentFails++; - $s6 = $this->peg_parseBlock_End(); + $s7 = $this->peg_parseBlock(); $this->peg_silentFails--; - if ($s6 === $this->peg_FAILED) { - $s5 = null; + if ($s7 === $this->peg_FAILED) { + $s6 = null; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 !== $this->peg_FAILED) { + $s7 = $this->peg_currPos; + $this->peg_silentFails++; + $s8 = $this->peg_parseBlock_End(); + $this->peg_silentFails--; + if ($s8 === $this->peg_FAILED) { + $s7 = null; + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + if ($s7 !== $this->peg_FAILED) { + if ($this->input_length > $this->peg_currPos) { + $s8 = $this->input_substr($this->peg_currPos, 1); + $this->peg_currPos++; + } else { + $s8 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { + $this->peg_fail($this->peg_c0); + } + } + if ($s8 !== $this->peg_FAILED) { + $s6 = array($s6, $s7, $s8); + $s5 = $s6; + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } } else { $this->peg_currPos = $s5; $s5 = $this->peg_FAILED; } if ($s5 !== $this->peg_FAILED) { - if ($this->input_length > $this->peg_currPos) { - $s6 = $this->input_substr($this->peg_currPos, 1); - $this->peg_currPos++; - } else { - $s6 = $this->peg_FAILED; - if ($this->peg_silentFails === 0) { - $this->peg_fail($this->peg_c0); + while ($s5 !== $this->peg_FAILED) { + $s4[] = $s5; + $s5 = $this->peg_currPos; + $s6 = $this->peg_currPos; + $this->peg_silentFails++; + $s7 = $this->peg_parseBlock(); + $this->peg_silentFails--; + if ($s7 === $this->peg_FAILED) { + $s6 = null; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 !== $this->peg_FAILED) { + $s7 = $this->peg_currPos; + $this->peg_silentFails++; + $s8 = $this->peg_parseBlock_End(); + $this->peg_silentFails--; + if ($s8 === $this->peg_FAILED) { + $s7 = null; + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + if ($s7 !== $this->peg_FAILED) { + if ($this->input_length > $this->peg_currPos) { + $s8 = $this->input_substr($this->peg_currPos, 1); + $this->peg_currPos++; + } else { + $s8 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { + $this->peg_fail($this->peg_c0); + } + } + if ($s8 !== $this->peg_FAILED) { + $s6 = array($s6, $s7, $s8); + $s5 = $s6; + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; } - } - 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 ($s4 !== $this->peg_FAILED) { @@ -754,36 +826,106 @@ private function peg_parseBlock_Balanced() { $s3 = $this->peg_parseBlock(); if ($s3 === $this->peg_FAILED) { $s3 = $this->peg_currPos; - $s4 = $this->peg_currPos; + $s4 = array(); $s5 = $this->peg_currPos; + $s6 = $this->peg_currPos; $this->peg_silentFails++; - $s6 = $this->peg_parseBlock_End(); + $s7 = $this->peg_parseBlock(); $this->peg_silentFails--; - if ($s6 === $this->peg_FAILED) { - $s5 = null; + if ($s7 === $this->peg_FAILED) { + $s6 = null; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 !== $this->peg_FAILED) { + $s7 = $this->peg_currPos; + $this->peg_silentFails++; + $s8 = $this->peg_parseBlock_End(); + $this->peg_silentFails--; + if ($s8 === $this->peg_FAILED) { + $s7 = null; + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + if ($s7 !== $this->peg_FAILED) { + if ($this->input_length > $this->peg_currPos) { + $s8 = $this->input_substr($this->peg_currPos, 1); + $this->peg_currPos++; + } else { + $s8 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { + $this->peg_fail($this->peg_c0); + } + } + if ($s8 !== $this->peg_FAILED) { + $s6 = array($s6, $s7, $s8); + $s5 = $s6; + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } } else { $this->peg_currPos = $s5; $s5 = $this->peg_FAILED; } if ($s5 !== $this->peg_FAILED) { - if ($this->input_length > $this->peg_currPos) { - $s6 = $this->input_substr($this->peg_currPos, 1); - $this->peg_currPos++; - } else { - $s6 = $this->peg_FAILED; - if ($this->peg_silentFails === 0) { - $this->peg_fail($this->peg_c0); + while ($s5 !== $this->peg_FAILED) { + $s4[] = $s5; + $s5 = $this->peg_currPos; + $s6 = $this->peg_currPos; + $this->peg_silentFails++; + $s7 = $this->peg_parseBlock(); + $this->peg_silentFails--; + if ($s7 === $this->peg_FAILED) { + $s6 = null; + } else { + $this->peg_currPos = $s6; + $s6 = $this->peg_FAILED; + } + if ($s6 !== $this->peg_FAILED) { + $s7 = $this->peg_currPos; + $this->peg_silentFails++; + $s8 = $this->peg_parseBlock_End(); + $this->peg_silentFails--; + if ($s8 === $this->peg_FAILED) { + $s7 = null; + } else { + $this->peg_currPos = $s7; + $s7 = $this->peg_FAILED; + } + if ($s7 !== $this->peg_FAILED) { + if ($this->input_length > $this->peg_currPos) { + $s8 = $this->input_substr($this->peg_currPos, 1); + $this->peg_currPos++; + } else { + $s8 = $this->peg_FAILED; + if ($this->peg_silentFails === 0) { + $this->peg_fail($this->peg_c0); + } + } + if ($s8 !== $this->peg_FAILED) { + $s6 = array($s6, $s7, $s8); + $s5 = $s6; + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; + } + } else { + $this->peg_currPos = $s5; + $s5 = $this->peg_FAILED; } - } - 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 ($s4 !== $this->peg_FAILED) { @@ -1441,18 +1583,23 @@ public function parse($input) { // are the same as `json_decode` // array arguments are backwards because of PHP - if ( ! function_exists( 'peg_array_partition' ) ) { - function peg_array_partition( $array, $predicate ) { - $truthy = array(); - $falsey = array(); + if ( ! function_exists( 'peg_process_inner_content' ) ) { + function peg_process_inner_content( $array ) { + $html = ''; + $blocks = array(); + $content = array(); foreach ( $array as $item ) { - call_user_func( $predicate, $item ) - ? $truthy[] = $item - : $falsey[] = $item; + if ( is_string( $item ) ) { + $html .= $item; + $content[] = $item; + } else { + $blocks[] = $item; + $content[] = null; + } } - return array( $truthy, $falsey ); + return array( $html, $blocks, $content ); } } @@ -1465,7 +1612,8 @@ function peg_join_blocks( $pre, $tokens, $post ) { 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $pre + 'innerHTML' => $pre, + 'innerContent' => array( $pre ), ); } @@ -1479,7 +1627,8 @@ function peg_join_blocks( $pre, $tokens, $post ) { 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $html + 'innerHTML' => $html, + 'innerContent' => array( $html ), ); } } @@ -1489,7 +1638,8 @@ function peg_join_blocks( $pre, $tokens, $post ) { 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $post + 'innerHTML' => $post, + 'innerContent' => array( $post ), ); } diff --git a/packages/block-serialization-default-parser/parser.php b/packages/block-serialization-default-parser/parser.php index 9eb8aae492b723..2211cf0c192260 100644 --- a/packages/block-serialization-default-parser/parser.php +++ b/packages/block-serialization-default-parser/parser.php @@ -48,11 +48,26 @@ class WP_Block_Parser_Block { */ public $innerHTML; - function __construct( $name, $attrs, $innerBlocks, $innerHTML ) { + /** + * List of string fragments and null markers where inner blocks were found + * + * @example array( + * 'innerHTML' => 'BeforeInnerAfter', + * 'innerBlocks' => array( block, block ), + * 'innerContent' => array( 'Before', null, 'Inner', null, 'After' ), + * ) + * + * @since 4.2.0 + * @var array + */ + public $innerContent; + + function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) { $this->blockName = $name; $this->attrs = $attrs; $this->innerBlocks = $innerBlocks; $this->innerHTML = $innerHTML; + $this->innerContent = $innerContent; } } @@ -252,14 +267,14 @@ function proceed() { ) ); } - $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '' ); + $this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ); $this->offset = $start_offset + $token_length; return true; } // otherwise we found an inner block $this->add_inner_block( - new WP_Block_Parser_Block( $block_name, $attrs, array(), '' ), + new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length ); @@ -269,7 +284,7 @@ function proceed() { case 'block-opener': // track all newly-opened blocks on the stack array_push( $this->stack, new WP_Block_Parser_Frame( - new WP_Block_Parser_Block( $block_name, $attrs, array(), '' ), + new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ), $start_offset, $token_length, $start_offset + $token_length, @@ -306,7 +321,9 @@ function proceed() { * block and add it as a new innerBlock to the parent */ $stack_top = array_pop( $this->stack ); - $stack_top->block->innerHTML .= substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); + $html = substr( $this->document, $stack_top->prev_offset, $start_offset - $stack_top->prev_offset ); + $stack_top->block->innerHTML .= $html; + $stack_top->block->innerContent[] = $html; $stack_top->prev_offset = $start_offset + $token_length; $this->add_inner_block( @@ -406,7 +423,7 @@ function next_token() { * @return WP_Block_Parser_Block freeform block object */ static function freeform( $innerHTML ) { - return new WP_Block_Parser_Block( null, array(), array(), $innerHTML ); + return new WP_Block_Parser_Block( null, array(), array(), $innerHTML, array( $innerHTML ) ); } /** @@ -441,7 +458,14 @@ function add_freeform( $length = null ) { function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) { $parent = $this->stack[ count( $this->stack ) - 1 ]; $parent->block->innerBlocks[] = $block; - $parent->block->innerHTML .= substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); + $html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset ); + + if ( ! empty( $html ) ) { + $parent->block->innerHTML .= $html; + $parent->block->innerContent[] = $html; + } + + $parent->block->innerContent[] = null; $parent->prev_offset = $last_offset ? $last_offset : $token_start + $token_length; } @@ -456,10 +480,15 @@ function add_block_from_stack( $end_offset = null ) { $stack_top = array_pop( $this->stack ); $prev_offset = $stack_top->prev_offset; - $stack_top->block->innerHTML .= isset( $end_offset ) + $html = isset( $end_offset ) ? substr( $this->document, $prev_offset, $end_offset - $prev_offset ) : substr( $this->document, $prev_offset ); + if ( ! empty( $html ) ) { + $stack_top->block->innerHTML .= $html; + $stack_top->block->innerContent[] = $html; + } + if ( isset( $stack_top->leading_html_start ) ) { $this->output[] = (array) self::freeform( substr( $this->document, diff --git a/packages/block-serialization-default-parser/src/index.js b/packages/block-serialization-default-parser/src/index.js index 27dd93bb9fb0f1..577284fc1e539e 100644 --- a/packages/block-serialization-default-parser/src/index.js +++ b/packages/block-serialization-default-parser/src/index.js @@ -4,17 +4,18 @@ let output; let stack; const tokenizer = /)[^])+?}\s+)?(\/)?-->/g; -function Block( blockName, attrs, innerBlocks, innerHTML ) { +function Block( blockName, attrs, innerBlocks, innerHTML, innerContent ) { return { blockName, attrs, innerBlocks, innerHTML, + innerContent, }; } function Freeform( innerHTML ) { - return Block( null, {}, [], innerHTML ); + return Block( null, {}, [], innerHTML, [ innerHTML ] ); } function Frame( block, tokenStart, tokenLength, prevOffset, leadingHtmlStart ) { @@ -84,14 +85,14 @@ function proceed() { if ( null !== leadingHtmlStart ) { output.push( Freeform( document.substr( leadingHtmlStart, startOffset - leadingHtmlStart ) ) ); } - output.push( Block( blockName, attrs, [], '' ) ); + output.push( Block( blockName, attrs, [], '', [] ) ); offset = startOffset + tokenLength; return true; } // otherwise we found an inner block addInnerBlock( - Block( blockName, attrs, [], '' ), + Block( blockName, attrs, [], '', [] ), startOffset, tokenLength, ); @@ -102,7 +103,7 @@ function proceed() { // track all newly-opened blocks on the stack stack.push( Frame( - Block( blockName, attrs, [], '' ), + Block( blockName, attrs, [], '', [] ), startOffset, tokenLength, startOffset + tokenLength, @@ -134,10 +135,9 @@ function proceed() { // otherwise we're nested and we have to close out the current // block and add it as a innerBlock to the parent const stackTop = stack.pop(); - stackTop.block.innerHTML += document.substr( - stackTop.prevOffset, - startOffset - stackTop.prevOffset, - ); + const html = document.substr( stackTop.prevOffset, startOffset - stackTop.prevOffset ); + stackTop.block.innerHTML += html; + stackTop.block.innerContent.push( html ); stackTop.prevOffset = startOffset + tokenLength; addInnerBlock( @@ -230,20 +230,25 @@ function addFreeform( rawLength ) { function addInnerBlock( block, tokenStart, tokenLength, lastOffset ) { const parent = stack[ stack.length - 1 ]; parent.block.innerBlocks.push( block ); - parent.block.innerHTML += document.substr( - parent.prevOffset, - tokenStart - parent.prevOffset, - ); + const html = document.substr( parent.prevOffset, tokenStart - parent.prevOffset ); + + if ( html ) { + parent.block.innerHTML += html; + parent.block.innerContent.push( html ); + } + + parent.block.innerContent.push( null ); parent.prevOffset = lastOffset ? lastOffset : tokenStart + tokenLength; } function addBlockFromStack( endOffset ) { const { block, leadingHtmlStart, prevOffset, tokenStart } = stack.pop(); - if ( endOffset ) { - block.innerHTML += document.substr( prevOffset, endOffset - prevOffset ); - } else { - block.innerHTML += document.substr( prevOffset ); + const html = endOffset ? document.substr( prevOffset, endOffset - prevOffset ) : document.substr( prevOffset ); + + if ( html ) { + block.innerHTML += html; + block.innerContent.push( html ); } if ( null !== leadingHtmlStart ) { diff --git a/packages/block-serialization-default-parser/test/__snapshots__/index.js.snap b/packages/block-serialization-default-parser/test/__snapshots__/index.js.snap index 5b5abb61a3d2e5..4a6910fa35f61c 100644 --- a/packages/block-serialization-default-parser/test/__snapshots__/index.js.snap +++ b/packages/block-serialization-default-parser/test/__snapshots__/index.js.snap @@ -6,6 +6,9 @@ Array [ "attrs": Object {}, "blockName": "core/more", "innerBlocks": Array [], + "innerContent": Array [ + "", + ], "innerHTML": "", }, ] @@ -17,6 +20,9 @@ Array [ "attrs": Object {}, "blockName": "core/more", "innerBlocks": Array [], + "innerContent": Array [ + "", + ], "innerHTML": "", }, ] diff --git a/packages/block-serialization-spec-parser/grammar.pegjs b/packages/block-serialization-spec-parser/grammar.pegjs index 00d1fec2114136..4bf80d2f6755ac 100644 --- a/packages/block-serialization-spec-parser/grammar.pegjs +++ b/packages/block-serialization-spec-parser/grammar.pegjs @@ -51,18 +51,23 @@ // are the same as `json_decode` // array arguments are backwards because of PHP -if ( ! function_exists( 'peg_array_partition' ) ) { - function peg_array_partition( $array, $predicate ) { - $truthy = array(); - $falsey = array(); +if ( ! function_exists( 'peg_process_inner_content' ) ) { + function peg_process_inner_content( $array ) { + $html = ''; + $blocks = array(); + $content = array(); foreach ( $array as $item ) { - call_user_func( $predicate, $item ) - ? $truthy[] = $item - : $falsey[] = $item; + if ( is_string( $item ) ) { + $html .= $item; + $content[] = $item; + } else { + $blocks[] = $item; + $content[] = null; + } } - return array( $truthy, $falsey ); + return array( $html, $blocks, $content ); } } @@ -75,7 +80,8 @@ if ( ! function_exists( 'peg_join_blocks' ) ) { 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $pre + 'innerHTML' => $pre, + 'innerContent' => array( $pre ), ); } @@ -89,7 +95,8 @@ if ( ! function_exists( 'peg_join_blocks' ) ) { 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $html + 'innerHTML' => $html, + 'innerContent' => array( $html ), ); } } @@ -99,7 +106,8 @@ if ( ! function_exists( 'peg_join_blocks' ) ) { 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $post + 'innerHTML' => $post, + 'innerContent' => array( $post ), ); } @@ -115,6 +123,7 @@ function freeform( s ) { attrs: {}, innerBlocks: [], innerHTML: s, + innerContent: [ s ], }; } @@ -151,22 +160,27 @@ function maybeJSON( s ) { } } -function partition( predicate, list ) { +function processInnerContent( list ) { var i, l, item; - var truthy = []; - var falsey = []; + var html = ''; + var blocks = []; + var content = []; // nod to performance over a simpler reduce // and clone model we could have taken here for ( i = 0, l = list.length; i < l; i++ ) { item = list[ i ]; - predicate( item ) - ? truthy.push( item ) - : falsey.push( item ) + if ( 'string' === typeof item ) { + html += item; + content.push( item ); + } else { + blocks.push( item ); + content.push( null ); + } }; - return [ truthy, falsey ]; + return [ html, blocks, content ]; } } @@ -197,10 +211,11 @@ Block_Void { /** $blockName, - 'attrs' => isset( $attrs ) ? $attrs : array(), - 'innerBlocks' => array(), - 'innerHTML' => '', + 'blockName' => $blockName, + 'attrs' => isset( $attrs ) ? $attrs : array(), + 'innerBlocks' => array(), + 'innerHTML' => '', + 'innerContent' => array(), ); ?> **/ @@ -208,33 +223,37 @@ Block_Void blockName: blockName, attrs: attrs || {}, innerBlocks: [], - innerHTML: '' + innerHTML: '', + innerContent: [] }; } Block_Balanced - = s:Block_Start children:(Block / $(!Block_End .))* e:Block_End + = s:Block_Start children:(Block / $((!Block !Block_End .)+))* e:Block_End { /** $s['blockName'], 'attrs' => $s['attrs'], 'innerBlocks' => $innerBlocks, - 'innerHTML' => implode( '', $innerHTML ), + 'innerHTML' => $innerHTML, + 'innerContent' => $innerContent, ); ?> **/ - var innerContent = partition( function( a ) { return 'string' === typeof a }, children ); - var innerHTML = innerContent[ 0 ]; - var innerBlocks = innerContent[ 1 ]; + var innerParts = processInnerContent( children ); + var innerHTML = innerParts[ 0 ]; + var innerBlocks = innerParts[ 1 ]; + var innerContent = innerParts[ 2 ]; return { blockName: s.blockName, attrs: s.attrs, innerBlocks: innerBlocks, - innerHTML: innerHTML.join( '' ) + innerHTML: innerHTML, + innerContent: innerContent, }; } diff --git a/packages/block-serialization-spec-parser/parser.js b/packages/block-serialization-spec-parser/parser.js index e716efb9e3e8d2..85fdc6ec9b5d65 100644 --- a/packages/block-serialization-spec-parser/parser.js +++ b/packages/block-serialization-spec-parser/parser.js @@ -165,10 +165,11 @@ peg$c10 = function(blockName, attrs) { /** $blockName, - 'attrs' => isset( $attrs ) ? $attrs : array(), - 'innerBlocks' => array(), - 'innerHTML' => '', + 'blockName' => $blockName, + 'attrs' => isset( $attrs ) ? $attrs : array(), + 'innerBlocks' => array(), + 'innerHTML' => '', + 'innerContent' => array(), ); ?> **/ @@ -176,30 +177,34 @@ blockName: blockName, attrs: attrs || {}, innerBlocks: [], - innerHTML: '' + innerHTML: '', + innerContent: [] }; }, peg$c11 = function(s, children, e) { /** $s['blockName'], 'attrs' => $s['attrs'], 'innerBlocks' => $innerBlocks, - 'innerHTML' => implode( '', $innerHTML ), + 'innerHTML' => $innerHTML, + 'innerContent' => $innerContent, ); ?> **/ - var innerContent = partition( function( a ) { return 'string' === typeof a }, children ); - var innerHTML = innerContent[ 0 ]; - var innerBlocks = innerContent[ 1 ]; + var innerParts = processInnerContent( children ); + var innerHTML = innerParts[ 0 ]; + var innerBlocks = innerParts[ 1 ]; + var innerContent = innerParts[ 2 ]; return { blockName: s.blockName, attrs: s.attrs, innerBlocks: innerBlocks, - innerHTML: innerHTML.join( '' ) + innerHTML: innerHTML, + innerContent: innerContent, }; }, peg$c12 = "-->", @@ -784,7 +789,7 @@ } function peg$parseBlock_Balanced() { - var s0, s1, s2, s3, s4, s5, s6; + var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parseBlock_Start(); @@ -793,34 +798,102 @@ s3 = peg$parseBlock(); if (s3 === peg$FAILED) { s3 = peg$currPos; - s4 = peg$currPos; + s4 = []; s5 = peg$currPos; + s6 = peg$currPos; peg$silentFails++; - s6 = peg$parseBlock_End(); + s7 = peg$parseBlock(); peg$silentFails--; - if (s6 === peg$FAILED) { - s5 = void 0; + if (s7 === peg$FAILED) { + s6 = void 0; } else { - peg$currPos = s5; - s5 = peg$FAILED; + peg$currPos = s6; + s6 = peg$FAILED; } - if (s5 !== peg$FAILED) { - if (input.length > peg$currPos) { - s6 = input.charAt(peg$currPos); - peg$currPos++; + if (s6 !== peg$FAILED) { + s7 = peg$currPos; + peg$silentFails++; + s8 = peg$parseBlock_End(); + peg$silentFails--; + if (s8 === peg$FAILED) { + s7 = void 0; } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c0); } + peg$currPos = s7; + s7 = peg$FAILED; } - if (s6 !== peg$FAILED) { - s5 = [s5, s6]; - s4 = s5; + if (s7 !== peg$FAILED) { + if (input.length > peg$currPos) { + s8 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c0); } + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } } else { - peg$currPos = s4; - s4 = peg$FAILED; + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$currPos; + peg$silentFails++; + s7 = peg$parseBlock(); + peg$silentFails--; + if (s7 === peg$FAILED) { + s6 = void 0; + } else { + peg$currPos = s6; + s6 = peg$FAILED; + } + if (s6 !== peg$FAILED) { + s7 = peg$currPos; + peg$silentFails++; + s8 = peg$parseBlock_End(); + peg$silentFails--; + if (s8 === peg$FAILED) { + s7 = void 0; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + if (s7 !== peg$FAILED) { + if (input.length > peg$currPos) { + s8 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c0); } + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } } } else { - peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { @@ -834,34 +907,102 @@ s3 = peg$parseBlock(); if (s3 === peg$FAILED) { s3 = peg$currPos; - s4 = peg$currPos; + s4 = []; s5 = peg$currPos; + s6 = peg$currPos; peg$silentFails++; - s6 = peg$parseBlock_End(); + s7 = peg$parseBlock(); peg$silentFails--; - if (s6 === peg$FAILED) { - s5 = void 0; + if (s7 === peg$FAILED) { + s6 = void 0; } else { - peg$currPos = s5; - s5 = peg$FAILED; + peg$currPos = s6; + s6 = peg$FAILED; } - if (s5 !== peg$FAILED) { - if (input.length > peg$currPos) { - s6 = input.charAt(peg$currPos); - peg$currPos++; + if (s6 !== peg$FAILED) { + s7 = peg$currPos; + peg$silentFails++; + s8 = peg$parseBlock_End(); + peg$silentFails--; + if (s8 === peg$FAILED) { + s7 = void 0; } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c0); } + peg$currPos = s7; + s7 = peg$FAILED; } - if (s6 !== peg$FAILED) { - s5 = [s5, s6]; - s4 = s5; + if (s7 !== peg$FAILED) { + if (input.length > peg$currPos) { + s8 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c0); } + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } } else { - peg$currPos = s4; - s4 = peg$FAILED; + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$currPos; + peg$silentFails++; + s7 = peg$parseBlock(); + peg$silentFails--; + if (s7 === peg$FAILED) { + s6 = void 0; + } else { + peg$currPos = s6; + s6 = peg$FAILED; + } + if (s6 !== peg$FAILED) { + s7 = peg$currPos; + peg$silentFails++; + s8 = peg$parseBlock_End(); + peg$silentFails--; + if (s8 === peg$FAILED) { + s7 = void 0; + } else { + peg$currPos = s7; + s7 = peg$FAILED; + } + if (s7 !== peg$FAILED) { + if (input.length > peg$currPos) { + s8 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s8 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c0); } + } + if (s8 !== peg$FAILED) { + s6 = [s6, s7, s8]; + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } } } else { - peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { @@ -1478,18 +1619,23 @@ // are the same as `json_decode` // array arguments are backwards because of PHP - if ( ! function_exists( 'peg_array_partition' ) ) { - function peg_array_partition( $array, $predicate ) { - $truthy = array(); - $falsey = array(); + if ( ! function_exists( 'peg_process_inner_content' ) ) { + function peg_process_inner_content( $array ) { + $html = ''; + $blocks = array(); + $content = array(); foreach ( $array as $item ) { - call_user_func( $predicate, $item ) - ? $truthy[] = $item - : $falsey[] = $item; + if ( is_string( $item ) ) { + $html .= $item; + $content[] = $item; + } else { + $blocks[] = $item; + $content[] = null; + } } - return array( $truthy, $falsey ); + return array( $html, $blocks, $content ); } } @@ -1502,7 +1648,8 @@ 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $pre + 'innerHTML' => $pre, + 'innerContent' => array( $pre ), ); } @@ -1516,7 +1663,8 @@ 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $html + 'innerHTML' => $html, + 'innerContent' => array( $html ), ); } } @@ -1526,7 +1674,8 @@ 'blockName' => null, 'attrs' => array(), 'innerBlocks' => array(), - 'innerHTML' => $post + 'innerHTML' => $post, + 'innerContent' => array( $post ), ); } @@ -1542,6 +1691,7 @@ attrs: {}, innerBlocks: [], innerHTML: s, + innerContent: [ s ], }; } @@ -1578,22 +1728,27 @@ } } - function partition( predicate, list ) { + function processInnerContent( list ) { var i, l, item; - var truthy = []; - var falsey = []; + var html = ''; + var blocks = []; + var content = []; // nod to performance over a simpler reduce // and clone model we could have taken here for ( i = 0, l = list.length; i < l; i++ ) { item = list[ i ]; - predicate( item ) - ? truthy.push( item ) - : falsey.push( item ) + if ( 'string' === typeof item ) { + html += item; + content.push( item ); + } else { + blocks.push( item ); + content.push( null ); + } }; - return [ truthy, falsey ]; + return [ html, blocks, content ]; } diff --git a/packages/block-serialization-spec-parser/shared-tests.js b/packages/block-serialization-spec-parser/shared-tests.js index abfee9be4b5216..54137636d3afdf 100644 --- a/packages/block-serialization-spec-parser/shared-tests.js +++ b/packages/block-serialization-spec-parser/shared-tests.js @@ -62,6 +62,33 @@ export const jsTester = ( parse ) => () => { ] ) ) ); } ); + describe( 'innerBlock placemarkers', () => { + test( 'innerContent exists', () => { + expect( parse( 'test' )[ 0 ] ).toHaveProperty( 'innerContent', [ 'test' ] ); + expect( parse( '' )[ 0 ] ).toHaveProperty( 'innerContent', [] ); + } ); + + test( 'innerContent contains innerHTML', () => { + expect( parse( 'Inner' )[ 0 ] ).toHaveProperty( 'innerContent', [ 'Inner' ] ); + } ); + + test( 'block locations become null', () => { + expect( parse( '' )[ 0 ] ).toHaveProperty( 'innerContent', [ null ] ); + } ); + + test( 'HTML soup appears after blocks', () => { + expect( parse( 'After' )[ 0 ] ).toHaveProperty( 'innerContent', [ null, 'After' ] ); + } ); + + test( 'HTML soup appears before blocks', () => { + expect( parse( 'Before' )[ 0 ] ).toHaveProperty( 'innerContent', [ 'Before', null ] ); + } ); + + test( 'blocks follow each other', () => { + expect( parse( '' )[ 0 ] ).toHaveProperty( 'innerContent', [ null, null ] ); + } ); + } ); + describe( 'attack vectors', () => { test( 'really long JSON attribute sections', () => { const length = 100000; diff --git a/packages/block-serialization-spec-parser/test/__snapshots__/index.js.snap b/packages/block-serialization-spec-parser/test/__snapshots__/index.js.snap index 1a014545d98744..480cde5428505b 100644 --- a/packages/block-serialization-spec-parser/test/__snapshots__/index.js.snap +++ b/packages/block-serialization-spec-parser/test/__snapshots__/index.js.snap @@ -6,6 +6,9 @@ Array [ "attrs": Object {}, "blockName": "core/more", "innerBlocks": Array [], + "innerContent": Array [ + "", + ], "innerHTML": "", }, ] @@ -17,6 +20,9 @@ Array [ "attrs": Array [], "blockName": "core/more", "innerBlocks": Array [], + "innerContent": Array [ + "", + ], "innerHTML": "", }, ] diff --git a/test/integration/full-content/fixtures/core__4-invalid-starting-letter.parsed.json b/test/integration/full-content/fixtures/core__4-invalid-starting-letter.parsed.json index 2dfce101b41c98..b3c0c79ad5cf36 100644 --- a/test/integration/full-content/fixtures/core__4-invalid-starting-letter.parsed.json +++ b/test/integration/full-content/fixtures/core__4-invalid-starting-letter.parsed.json @@ -3,6 +3,9 @@ "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__archives.parsed.json b/test/integration/full-content/fixtures/core__archives.parsed.json index fab690ff93afdf..f974a7a167ab33 100644 --- a/test/integration/full-content/fixtures/core__archives.parsed.json +++ b/test/integration/full-content/fixtures/core__archives.parsed.json @@ -6,6 +6,7 @@ "showPostCounts": false }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] } ] diff --git a/test/integration/full-content/fixtures/core__archives__showPostCounts.parsed.json b/test/integration/full-content/fixtures/core__archives__showPostCounts.parsed.json index cd58cbf96924db..88439c3fc9ff0e 100644 --- a/test/integration/full-content/fixtures/core__archives__showPostCounts.parsed.json +++ b/test/integration/full-content/fixtures/core__archives__showPostCounts.parsed.json @@ -6,6 +6,7 @@ "showPostCounts": true }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] } ] diff --git a/test/integration/full-content/fixtures/core__audio.parsed.json b/test/integration/full-content/fixtures/core__audio.parsed.json index 33926c0b889b55..6b0acbd0c4a1fb 100644 --- a/test/integration/full-content/fixtures/core__audio.parsed.json +++ b/test/integration/full-content/fixtures/core__audio.parsed.json @@ -5,12 +5,14 @@ "align": "right" }, "innerBlocks": [], - "innerHTML": "\n
\n \n
\n" + "innerHTML": "\n
\n \n
\n", + "innerContent": [ "\n
\n \n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__block.parsed.json b/test/integration/full-content/fixtures/core__block.parsed.json index 61b65e317a8e1c..33c4d86f6c6c7c 100644 --- a/test/integration/full-content/fixtures/core__block.parsed.json +++ b/test/integration/full-content/fixtures/core__block.parsed.json @@ -5,12 +5,14 @@ "ref": 123 }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__button__center.parsed.json b/test/integration/full-content/fixtures/core__button__center.parsed.json index 0094e8f2640736..352767e1c1a8f3 100644 --- a/test/integration/full-content/fixtures/core__button__center.parsed.json +++ b/test/integration/full-content/fixtures/core__button__center.parsed.json @@ -5,12 +5,14 @@ "align": "center" }, "innerBlocks": [], - "innerHTML": "\n
Help build Gutenberg
\n" + "innerHTML": "\n
Help build Gutenberg
\n", + "innerContent": [ "\n
Help build Gutenberg
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__categories.parsed.json b/test/integration/full-content/fixtures/core__categories.parsed.json index df39a8078db37b..60d03d7bc50625 100644 --- a/test/integration/full-content/fixtures/core__categories.parsed.json +++ b/test/integration/full-content/fixtures/core__categories.parsed.json @@ -7,12 +7,14 @@ "showHierarchy": false }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__code.parsed.json b/test/integration/full-content/fixtures/core__code.parsed.json index 5aea1d9a14a013..d9bf0a215e82b8 100644 --- a/test/integration/full-content/fixtures/core__code.parsed.json +++ b/test/integration/full-content/fixtures/core__code.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/code", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
export default function MyButton() {\n\treturn <Button>Click Me!</Button>;\n}
\n" + "innerHTML": "\n
export default function MyButton() {\n\treturn <Button>Click Me!</Button>;\n}
\n", + "innerContent": [ "\n
export default function MyButton() {\n\treturn <Button>Click Me!</Button>;\n}
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__column.parsed.json b/test/integration/full-content/fixtures/core__column.parsed.json index 74b53bdf6ae966..10f1e1a07cf05b 100644 --- a/test/integration/full-content/fixtures/core__column.parsed.json +++ b/test/integration/full-content/fixtures/core__column.parsed.json @@ -7,21 +7,25 @@ "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\t

Column One, Paragraph One

\n\t" + "innerHTML": "\n\t

Column One, Paragraph One

\n\t", + "innerContent": [ "\n\t

Column One, Paragraph One

\n\t" ] }, { "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\t

Column One, Paragraph Two

\n\t" + "innerHTML": "\n\t

Column One, Paragraph Two

\n\t", + "innerContent": [ "\n\t

Column One, Paragraph Two

\n\t" ] } ], - "innerHTML": "\n
\n\t\n\t\n
\n" + "innerHTML": "\n
\n\t\n\t\n
\n", + "innerContent": [ "\n
\n\t", null, "\n\t", null, "\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__columns.parsed.json b/test/integration/full-content/fixtures/core__columns.parsed.json index 9ec5cef66ad232..7dbde278bc08c6 100644 --- a/test/integration/full-content/fixtures/core__columns.parsed.json +++ b/test/integration/full-content/fixtures/core__columns.parsed.json @@ -13,16 +13,29 @@ "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\t\t

Column One, Paragraph One

\n\t\t" + "innerHTML": "\n\t\t

Column One, Paragraph One

\n\t\t", + "innerContent": [ + "\n\t\t

Column One, Paragraph One

\n\t\t" + ] }, { "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\t\t

Column One, Paragraph Two

\n\t\t" + "innerHTML": "\n\t\t

Column One, Paragraph Two

\n\t\t", + "innerContent": [ + "\n\t\t

Column One, Paragraph Two

\n\t\t" + ] } ], - "innerHTML": "\n\t
\n\t\t\n\t\t\n\t
\n\t" + "innerHTML": "\n\t
\n\t\t\n\t\t\n\t
\n\t", + "innerContent": [ + "\n\t
\n\t\t", + null, + "\n\t\t", + null, + "\n\t
\n\t" + ] }, { "blockName": "core/column", @@ -32,24 +45,47 @@ "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\t\t

Column Two, Paragraph One

\n\t\t" + "innerHTML": "\n\t\t

Column Two, Paragraph One

\n\t\t", + "innerContent": [ + "\n\t\t

Column Two, Paragraph One

\n\t\t" + ] }, { "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\t\t

Column Three, Paragraph One

\n\t\t" + "innerHTML": "\n\t\t

Column Three, Paragraph One

\n\t\t", + "innerContent": [ + "\n\t\t

Column Three, Paragraph One

\n\t\t" + ] } ], - "innerHTML": "\n\t
\n\t\t\n\t\t\n\t
\n\t" + "innerHTML": "\n\t
\n\t\t\n\t\t\n\t
\n\t", + "innerContent": [ + "\n\t
\n\t\t", + null, + "\n\t\t", + null, + "\n\t
\n\t" + ] } ], - "innerHTML": "\n
\n\t\n\t\n
\n" + "innerHTML": "\n
\n\t\n\t\n
\n", + "innerContent": [ + "\n
\n\t", + null, + "\n\t", + null, + "\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__columns__deprecated.parsed.json b/test/integration/full-content/fixtures/core__columns__deprecated.parsed.json index 2d973027f4a5a3..6bb604b40ecfb1 100644 --- a/test/integration/full-content/fixtures/core__columns__deprecated.parsed.json +++ b/test/integration/full-content/fixtures/core__columns__deprecated.parsed.json @@ -11,7 +11,10 @@ "layout": "column-1" }, "innerBlocks": [], - "innerHTML": "\n\t

Column One, Paragraph One

\n\t" + "innerHTML": "\n\t

Column One, Paragraph One

\n\t", + "innerContent": [ + "\n\t

Column One, Paragraph One

\n\t" + ] }, { "blockName": "core/paragraph", @@ -19,7 +22,10 @@ "layout": "column-1" }, "innerBlocks": [], - "innerHTML": "\n\t

Column One, Paragraph Two

\n\t" + "innerHTML": "\n\t

Column One, Paragraph Two

\n\t", + "innerContent": [ + "\n\t

Column One, Paragraph Two

\n\t" + ] }, { "blockName": "core/paragraph", @@ -27,7 +33,10 @@ "layout": "column-2" }, "innerBlocks": [], - "innerHTML": "\n\t

Column Two, Paragraph One

\n\t" + "innerHTML": "\n\t

Column Two, Paragraph One

\n\t", + "innerContent": [ + "\n\t

Column Two, Paragraph One

\n\t" + ] }, { "blockName": "core/paragraph", @@ -35,15 +44,32 @@ "layout": "column-3" }, "innerBlocks": [], - "innerHTML": "\n\t

Column Three, Paragraph One

\n\t" + "innerHTML": "\n\t

Column Three, Paragraph One

\n\t", + "innerContent": [ + "\n\t

Column Three, Paragraph One

\n\t" + ] } ], - "innerHTML": "\n
\n\t\n\t\n\t\n\t\n
\n" + "innerHTML": "\n
\n\t\n\t\n\t\n\t\n
\n", + "innerContent": [ + "\n
\n\t", + null, + "\n\t", + null, + "\n\t", + null, + "\n\t", + null, + "\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__cover.parsed.json b/test/integration/full-content/fixtures/core__cover.parsed.json index ba371b9c5960ff..14f37b617067b4 100644 --- a/test/integration/full-content/fixtures/core__cover.parsed.json +++ b/test/integration/full-content/fixtures/core__cover.parsed.json @@ -6,12 +6,18 @@ "dimRatio": 40 }, "innerBlocks": [], - "innerHTML": "\n
\n

Guten Berg!

\n
\n" + "innerHTML": "\n
\n

Guten Berg!

\n
\n", + "innerContent": [ + "\n
\n

Guten Berg!

\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__cover__video-overlay.parsed.json b/test/integration/full-content/fixtures/core__cover__video-overlay.parsed.json index 71dd6c0a0294ad..a2a3ccc94a7136 100644 --- a/test/integration/full-content/fixtures/core__cover__video-overlay.parsed.json +++ b/test/integration/full-content/fixtures/core__cover__video-overlay.parsed.json @@ -8,12 +8,18 @@ "backgroundType": "video" }, "innerBlocks": [], - "innerHTML": "\n
\n\t\n\t

Guten Berg!

\n
\n" + "innerHTML": "\n
\n\t\n\t

Guten Berg!

\n
\n", + "innerContent": [ + "\n
\n\t\n\t

Guten Berg!

\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__cover__video.parsed.json b/test/integration/full-content/fixtures/core__cover__video.parsed.json index 218846a689b1f2..a864b5fea344ed 100644 --- a/test/integration/full-content/fixtures/core__cover__video.parsed.json +++ b/test/integration/full-content/fixtures/core__cover__video.parsed.json @@ -7,12 +7,18 @@ "backgroundType": "video" }, "innerBlocks": [], - "innerHTML": "\n
\n\t\n\t

Guten Berg!

\n
\n" + "innerHTML": "\n
\n\t\n\t

Guten Berg!

\n
\n", + "innerContent": [ + "\n
\n\t\n\t

Guten Berg!

\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__embed.parsed.json b/test/integration/full-content/fixtures/core__embed.parsed.json index 5efa23bb5f83c4..43bbfac823cd06 100644 --- a/test/integration/full-content/fixtures/core__embed.parsed.json +++ b/test/integration/full-content/fixtures/core__embed.parsed.json @@ -5,12 +5,18 @@ "url": "https://example.com/" }, "innerBlocks": [], - "innerHTML": "\n
\n
\n https://example.com/\n
\n
Embedded content from an example URL
\n
\n" + "innerHTML": "\n
\n
\n https://example.com/\n
\n
Embedded content from an example URL
\n
\n", + "innerContent": [ + "\n
\n
\n https://example.com/\n
\n
Embedded content from an example URL
\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__file__new-window.parsed.json b/test/integration/full-content/fixtures/core__file__new-window.parsed.json index c674f669bc26fe..a29bea33c5b2ba 100644 --- a/test/integration/full-content/fixtures/core__file__new-window.parsed.json +++ b/test/integration/full-content/fixtures/core__file__new-window.parsed.json @@ -7,12 +7,18 @@ "id": 176 }, "innerBlocks": [], - "innerHTML": "\n
6546Download
\n" + "innerHTML": "\n
6546Download
\n", + "innerContent": [ + "\n
6546Download
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__file__no-download-button.parsed.json b/test/integration/full-content/fixtures/core__file__no-download-button.parsed.json index 65a2cffa5ec9a5..ac019b969423ca 100644 --- a/test/integration/full-content/fixtures/core__file__no-download-button.parsed.json +++ b/test/integration/full-content/fixtures/core__file__no-download-button.parsed.json @@ -7,12 +7,18 @@ "id": 176 }, "innerBlocks": [], - "innerHTML": "\n
lkjfijwef
\n" + "innerHTML": "\n
lkjfijwef
\n", + "innerContent": [ + "\n
lkjfijwef
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__file__no-text-link.parsed.json b/test/integration/full-content/fixtures/core__file__no-text-link.parsed.json index 6a891d4ea839c6..d70321c12c06dd 100644 --- a/test/integration/full-content/fixtures/core__file__no-text-link.parsed.json +++ b/test/integration/full-content/fixtures/core__file__no-text-link.parsed.json @@ -7,12 +7,18 @@ "id": 176 }, "innerBlocks": [], - "innerHTML": "\n
Download
\n" + "innerHTML": "\n
Download
\n", + "innerContent": [ + "\n
Download
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__freeform.parsed.json b/test/integration/full-content/fixtures/core__freeform.parsed.json index 5cf330c0e9e99e..1ec86e571b009c 100644 --- a/test/integration/full-content/fixtures/core__freeform.parsed.json +++ b/test/integration/full-content/fixtures/core__freeform.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/freeform", "attrs": {}, "innerBlocks": [], - "innerHTML": "\nTesting freeform block with some\n
\n\tHTML content\n
\n" + "innerHTML": "\nTesting freeform block with some\n
\n\tHTML content\n
\n", + "innerContent": [ + "\nTesting freeform block with some\n
\n\tHTML content\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__freeform__undelimited.parsed.json b/test/integration/full-content/fixtures/core__freeform__undelimited.parsed.json index 02999f7b830c4d..4aca91e2f3a228 100644 --- a/test/integration/full-content/fixtures/core__freeform__undelimited.parsed.json +++ b/test/integration/full-content/fixtures/core__freeform__undelimited.parsed.json @@ -3,6 +3,9 @@ "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "Testing freeform block with some\n
\n\tHTML content\n
\n" + "innerHTML": "Testing freeform block with some\n
\n\tHTML content\n
\n", + "innerContent": [ + "Testing freeform block with some\n
\n\tHTML content\n
\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__gallery.parsed.json b/test/integration/full-content/fixtures/core__gallery.parsed.json index 3d80657c7f204b..fc5c9e17d6890b 100644 --- a/test/integration/full-content/fixtures/core__gallery.parsed.json +++ b/test/integration/full-content/fixtures/core__gallery.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/gallery", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\n" + "innerHTML": "\n\n", + "innerContent": [ + "\n\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__gallery__columns.parsed.json b/test/integration/full-content/fixtures/core__gallery__columns.parsed.json index 44faed907a8fce..6f6e4b856d7ece 100644 --- a/test/integration/full-content/fixtures/core__gallery__columns.parsed.json +++ b/test/integration/full-content/fixtures/core__gallery__columns.parsed.json @@ -5,12 +5,18 @@ "columns": 1 }, "innerBlocks": [], - "innerHTML": "\n\n" + "innerHTML": "\n\n", + "innerContent": [ + "\n\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__heading__h2-em.parsed.json b/test/integration/full-content/fixtures/core__heading__h2-em.parsed.json index 76d235d42c8967..e10209f2270c98 100644 --- a/test/integration/full-content/fixtures/core__heading__h2-em.parsed.json +++ b/test/integration/full-content/fixtures/core__heading__h2-em.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/heading", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n

The Inserter Tool

\n" + "innerHTML": "\n

The Inserter Tool

\n", + "innerContent": [ + "\n

The Inserter Tool

\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__heading__h2.parsed.json b/test/integration/full-content/fixtures/core__heading__h2.parsed.json index 700f5f941e3fd2..be6bc63b316dea 100644 --- a/test/integration/full-content/fixtures/core__heading__h2.parsed.json +++ b/test/integration/full-content/fixtures/core__heading__h2.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/heading", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n

A picture is worth a thousand words, or so the saying goes

\n" + "innerHTML": "\n

A picture is worth a thousand words, or so the saying goes

\n", + "innerContent": [ + "\n

A picture is worth a thousand words, or so the saying goes

\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__html.parsed.json b/test/integration/full-content/fixtures/core__html.parsed.json index 2bfdc658667aef..adb0cd44b33672 100644 --- a/test/integration/full-content/fixtures/core__html.parsed.json +++ b/test/integration/full-content/fixtures/core__html.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/html", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n

Some HTML code

\nThis text will scroll from right to left\n" + "innerHTML": "\n

Some HTML code

\nThis text will scroll from right to left\n", + "innerContent": [ + "\n

Some HTML code

\nThis text will scroll from right to left\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__image.parsed.json b/test/integration/full-content/fixtures/core__image.parsed.json index fff414d9b01ba0..d7e16a440ddefb 100644 --- a/test/integration/full-content/fixtures/core__image.parsed.json +++ b/test/integration/full-content/fixtures/core__image.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/image", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
\"\"
\n" + "innerHTML": "\n
\"\"
\n", + "innerContent": [ + "\n
\"\"
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__image__attachment-link.parsed.json b/test/integration/full-content/fixtures/core__image__attachment-link.parsed.json index e5da07242d556c..fae6604516028e 100644 --- a/test/integration/full-content/fixtures/core__image__attachment-link.parsed.json +++ b/test/integration/full-content/fixtures/core__image__attachment-link.parsed.json @@ -5,12 +5,18 @@ "linkDestination": "attachment" }, "innerBlocks": [], - "innerHTML": "\n
\"\"
\n" + "innerHTML": "\n
\"\"
\n", + "innerContent": [ + "\n
\"\"
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__image__center-caption.parsed.json b/test/integration/full-content/fixtures/core__image__center-caption.parsed.json index 290057c2876a7c..02ff95e3ae8cb7 100644 --- a/test/integration/full-content/fixtures/core__image__center-caption.parsed.json +++ b/test/integration/full-content/fixtures/core__image__center-caption.parsed.json @@ -5,12 +5,18 @@ "align": "center" }, "innerBlocks": [], - "innerHTML": "\n
\"\"
Give it a try. Press the "really wide" button on the image toolbar.
\n" + "innerHTML": "\n
\"\"
Give it a try. Press the "really wide" button on the image toolbar.
\n", + "innerContent": [ + "\n
\"\"
Give it a try. Press the "really wide" button on the image toolbar.
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__image__custom-link.parsed.json b/test/integration/full-content/fixtures/core__image__custom-link.parsed.json index d814737aaedf28..a3625c6a1f683e 100644 --- a/test/integration/full-content/fixtures/core__image__custom-link.parsed.json +++ b/test/integration/full-content/fixtures/core__image__custom-link.parsed.json @@ -5,12 +5,18 @@ "linkDestination": "custom" }, "innerBlocks": [], - "innerHTML": "\n
\"\"
\n" + "innerHTML": "\n
\"\"
\n", + "innerContent": [ + "\n
\"\"
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__image__media-link.parsed.json b/test/integration/full-content/fixtures/core__image__media-link.parsed.json index 345c5d4e258ede..46458a7eec3d7b 100644 --- a/test/integration/full-content/fixtures/core__image__media-link.parsed.json +++ b/test/integration/full-content/fixtures/core__image__media-link.parsed.json @@ -5,12 +5,18 @@ "linkDestination": "media" }, "innerBlocks": [], - "innerHTML": "\n
\"\"
\n" + "innerHTML": "\n
\"\"
\n", + "innerContent": [ + "\n
\"\"
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__invalid-Capitals.parsed.json b/test/integration/full-content/fixtures/core__invalid-Capitals.parsed.json index c17c81b398cf37..cbfafc27db9e92 100644 --- a/test/integration/full-content/fixtures/core__invalid-Capitals.parsed.json +++ b/test/integration/full-content/fixtures/core__invalid-Capitals.parsed.json @@ -3,6 +3,9 @@ "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__invalid-special.parsed.json b/test/integration/full-content/fixtures/core__invalid-special.parsed.json index 3198b43be513ac..05b96f6deb2fc8 100644 --- a/test/integration/full-content/fixtures/core__invalid-special.parsed.json +++ b/test/integration/full-content/fixtures/core__invalid-special.parsed.json @@ -3,6 +3,9 @@ "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__latest-comments.parsed.json b/test/integration/full-content/fixtures/core__latest-comments.parsed.json index 7e8bb541adc0ca..b7a0e614220d8f 100644 --- a/test/integration/full-content/fixtures/core__latest-comments.parsed.json +++ b/test/integration/full-content/fixtures/core__latest-comments.parsed.json @@ -7,12 +7,16 @@ "displayTimestamp": true }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__latest-posts.parsed.json b/test/integration/full-content/fixtures/core__latest-posts.parsed.json index f1c800291d9bc7..4279957a0f5c1e 100644 --- a/test/integration/full-content/fixtures/core__latest-posts.parsed.json +++ b/test/integration/full-content/fixtures/core__latest-posts.parsed.json @@ -6,12 +6,16 @@ "displayPostDate": false }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__latest-posts__displayPostDate.parsed.json b/test/integration/full-content/fixtures/core__latest-posts__displayPostDate.parsed.json index a92b392679099b..57a36f5dce8b81 100644 --- a/test/integration/full-content/fixtures/core__latest-posts__displayPostDate.parsed.json +++ b/test/integration/full-content/fixtures/core__latest-posts__displayPostDate.parsed.json @@ -6,12 +6,16 @@ "displayPostDate": true }, "innerBlocks": [], - "innerHTML": "" + "innerHTML": "", + "innerContent": [] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__list__ul.parsed.json b/test/integration/full-content/fixtures/core__list__ul.parsed.json index c42181ba553ac2..83cb9ff7fc24d9 100644 --- a/test/integration/full-content/fixtures/core__list__ul.parsed.json +++ b/test/integration/full-content/fixtures/core__list__ul.parsed.json @@ -3,12 +3,18 @@ "blockName": "core/list", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\n" + "innerHTML": "\n\n", + "innerContent": [ + "\n\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__media-text.parsed.json b/test/integration/full-content/fixtures/core__media-text.parsed.json index 82df7099856696..ec0bf62e613174 100644 --- a/test/integration/full-content/fixtures/core__media-text.parsed.json +++ b/test/integration/full-content/fixtures/core__media-text.parsed.json @@ -13,15 +13,26 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

My Content

\n\t\t" + "innerHTML": "\n\t\t

My Content

\n\t\t", + "innerContent": [ + "\n\t\t

My Content

\n\t\t" + ] } ], - "innerHTML": "\n
\n\t
\n\t\t\"\"/\n\t
\n\t
\n\t\t\n\t
\n
\n" + "innerHTML": "\n
\n\t
\n\t\t\"\"/\n\t
\n\t
\n\t\t\n\t
\n
\n", + "innerContent": [ + "\n
\n\t
\n\t\t\"\"/\n\t
\n\t
\n\t\t", + null, + "\n\t
\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__media-text__image-alt-no-align.parsed.json b/test/integration/full-content/fixtures/core__media-text__image-alt-no-align.parsed.json index 5e9fc5b3f5e1e2..e078f9c6ae589d 100644 --- a/test/integration/full-content/fixtures/core__media-text__image-alt-no-align.parsed.json +++ b/test/integration/full-content/fixtures/core__media-text__image-alt-no-align.parsed.json @@ -14,15 +14,26 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

Content

\n\t\t" + "innerHTML": "\n\t\t

Content

\n\t\t", + "innerContent": [ + "\n\t\t

Content

\n\t\t" + ] } ], - "innerHTML": "\n
\n\t
\n\t\t\"my\n\t
\n\t
\n\t\t\n\t
\n
\n" + "innerHTML": "\n
\n\t
\n\t\t\"my\n\t
\n\t
\n\t\t\n\t
\n
\n", + "innerContent": [ + "\n
\n\t
\n\t\t\"my\n\t
\n\t
\n\t\t", + null, + "\n\t
\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__media-text__is-stacked-on-mobile.parsed.json b/test/integration/full-content/fixtures/core__media-text__is-stacked-on-mobile.parsed.json index ae97bce2009945..3451267ab68971 100644 --- a/test/integration/full-content/fixtures/core__media-text__is-stacked-on-mobile.parsed.json +++ b/test/integration/full-content/fixtures/core__media-text__is-stacked-on-mobile.parsed.json @@ -14,15 +14,26 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

My Content

\n\t\t" + "innerHTML": "\n\t\t

My Content

\n\t\t", + "innerContent": [ + "\n\t\t

My Content

\n\t\t" + ] } ], - "innerHTML": "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n" + "innerHTML": "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n", + "innerContent": [ + "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t", + null, + "\n\t
\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__media-text__media-right-custom-width.parsed.json b/test/integration/full-content/fixtures/core__media-text__media-right-custom-width.parsed.json index d344565dadc834..37484502190c7b 100644 --- a/test/integration/full-content/fixtures/core__media-text__media-right-custom-width.parsed.json +++ b/test/integration/full-content/fixtures/core__media-text__media-right-custom-width.parsed.json @@ -17,15 +17,26 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

My video

\n\t\t" + "innerHTML": "\n\t\t

My video

\n\t\t", + "innerContent": [ + "\n\t\t

My video

\n\t\t" + ] } ], - "innerHTML": "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n" + "innerHTML": "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n", + "innerContent": [ + "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t", + null, + "\n\t
\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__media-text__video.parsed.json b/test/integration/full-content/fixtures/core__media-text__video.parsed.json index ff58f6ab6c5fdc..4e06eb858a5208 100644 --- a/test/integration/full-content/fixtures/core__media-text__video.parsed.json +++ b/test/integration/full-content/fixtures/core__media-text__video.parsed.json @@ -13,15 +13,26 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

My Content

\n\t\t" + "innerHTML": "\n\t\t

My Content

\n\t\t", + "innerContent": [ + "\n\t\t

My Content

\n\t\t" + ] } ], - "innerHTML": "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n" + "innerHTML": "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n", + "innerContent": [ + "\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t", + null, + "\n\t
\n
\n" + ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ + "\n" + ] } ] diff --git a/test/integration/full-content/fixtures/core__missing.parsed.json b/test/integration/full-content/fixtures/core__missing.parsed.json index 3a559918b6619a..85ab1542c72a3b 100644 --- a/test/integration/full-content/fixtures/core__missing.parsed.json +++ b/test/integration/full-content/fixtures/core__missing.parsed.json @@ -6,12 +6,14 @@ "attr2": "Two" }, "innerBlocks": [], - "innerHTML": "\n

Testing missing block with some

\n
\n\tHTML content\n
\n" + "innerHTML": "\n

Testing missing block with some

\n
\n\tHTML content\n
\n", + "innerContent": [ "\n

Testing missing block with some

\n
\n\tHTML content\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__more.parsed.json b/test/integration/full-content/fixtures/core__more.parsed.json index 176e7fe7f7c161..b806b0c0af8dba 100644 --- a/test/integration/full-content/fixtures/core__more.parsed.json +++ b/test/integration/full-content/fixtures/core__more.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/more", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\n" + "innerHTML": "\n\n", + "innerContent": [ "\n\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__more__custom-text-teaser.parsed.json b/test/integration/full-content/fixtures/core__more__custom-text-teaser.parsed.json index a533e3c09c4712..e3096b9d7cdbb2 100644 --- a/test/integration/full-content/fixtures/core__more__custom-text-teaser.parsed.json +++ b/test/integration/full-content/fixtures/core__more__custom-text-teaser.parsed.json @@ -6,12 +6,14 @@ "noTeaser": true }, "innerBlocks": [], - "innerHTML": "\n\n\n" + "innerHTML": "\n\n\n", + "innerContent": [ "\n\n\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__nextpage.parsed.json b/test/integration/full-content/fixtures/core__nextpage.parsed.json index e4dd2534c821e3..ff3f2703bf69ae 100644 --- a/test/integration/full-content/fixtures/core__nextpage.parsed.json +++ b/test/integration/full-content/fixtures/core__nextpage.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/nextpage", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n\n" + "innerHTML": "\n\n", + "innerContent": [ "\n\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__paragraph__align-right.parsed.json b/test/integration/full-content/fixtures/core__paragraph__align-right.parsed.json index 060d40a38de5a1..e0c2ab7be237bc 100644 --- a/test/integration/full-content/fixtures/core__paragraph__align-right.parsed.json +++ b/test/integration/full-content/fixtures/core__paragraph__align-right.parsed.json @@ -5,12 +5,14 @@ "align": "right" }, "innerBlocks": [], - "innerHTML": "\n

... like this one, which is separate from the above and right aligned.

\n" + "innerHTML": "\n

... like this one, which is separate from the above and right aligned.

\n", + "innerContent": [ "\n

... like this one, which is separate from the above and right aligned.

\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__paragraph__deprecated.parsed.json b/test/integration/full-content/fixtures/core__paragraph__deprecated.parsed.json index ac11af1b3a92cf..e6b914e24e1110 100644 --- a/test/integration/full-content/fixtures/core__paragraph__deprecated.parsed.json +++ b/test/integration/full-content/fixtures/core__paragraph__deprecated.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/paragraph", "attrs": {}, "innerBlocks": [], - "innerHTML": "\nUnwrapped is still valid.\n" + "innerHTML": "\nUnwrapped is still valid.\n", + "innerContent": [ "\nUnwrapped is still valid.\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__preformatted.parsed.json b/test/integration/full-content/fixtures/core__preformatted.parsed.json index 247fdda2e3eee7..c78497076e90d2 100644 --- a/test/integration/full-content/fixtures/core__preformatted.parsed.json +++ b/test/integration/full-content/fixtures/core__preformatted.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/preformatted", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
Some preformatted text...
And more!
\n" + "innerHTML": "\n
Some preformatted text...
And more!
\n", + "innerContent": [ "\n
Some preformatted text...
And more!
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__pullquote.parsed.json b/test/integration/full-content/fixtures/core__pullquote.parsed.json index 0e39eea4ec89ce..033b311fa5a190 100644 --- a/test/integration/full-content/fixtures/core__pullquote.parsed.json +++ b/test/integration/full-content/fixtures/core__pullquote.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/pullquote", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
\n
\n

Testing pullquote block...

...with a caption\n
\n
\n" + "innerHTML": "\n
\n
\n

Testing pullquote block...

...with a caption\n
\n
\n", + "innerContent": [ "\n
\n
\n

Testing pullquote block...

...with a caption\n
\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json index 3b303a0d8d157a..fe8abfce70a364 100644 --- a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json +++ b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/pullquote", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
\n
\n

Paragraph one

\n

Paragraph two

\n by whomever\n\t
\n
\n" + "innerHTML": "\n
\n
\n

Paragraph one

\n

Paragraph two

\n by whomever\n\t
\n
\n", + "innerContent": [ "\n
\n
\n

Paragraph one

\n

Paragraph two

\n by whomever\n\t
\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__quote__style-1.parsed.json b/test/integration/full-content/fixtures/core__quote__style-1.parsed.json index 12f480ef313feb..6a873438f17316 100644 --- a/test/integration/full-content/fixtures/core__quote__style-1.parsed.json +++ b/test/integration/full-content/fixtures/core__quote__style-1.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/quote", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n

The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.

Matt Mullenweg, 2017
\n" + "innerHTML": "\n

The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.

Matt Mullenweg, 2017
\n", + "innerContent": [ "\n

The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.

Matt Mullenweg, 2017
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__quote__style-2.parsed.json b/test/integration/full-content/fixtures/core__quote__style-2.parsed.json index 87a9377e2e9ede..6470afbc17a2e1 100644 --- a/test/integration/full-content/fixtures/core__quote__style-2.parsed.json +++ b/test/integration/full-content/fixtures/core__quote__style-2.parsed.json @@ -5,12 +5,14 @@ "className": "is-style-large" }, "innerBlocks": [], - "innerHTML": "\n

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

Maya Angelou
\n" + "innerHTML": "\n

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

Maya Angelou
\n", + "innerContent": [ "\n

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

Maya Angelou
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__separator.parsed.json b/test/integration/full-content/fixtures/core__separator.parsed.json index d01eb1eed1f591..48a8e742c35b05 100644 --- a/test/integration/full-content/fixtures/core__separator.parsed.json +++ b/test/integration/full-content/fixtures/core__separator.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/separator", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
\n" + "innerHTML": "\n
\n", + "innerContent": [ "\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__shortcode.parsed.json b/test/integration/full-content/fixtures/core__shortcode.parsed.json index 70d24dc2762532..b875770f15a452 100644 --- a/test/integration/full-content/fixtures/core__shortcode.parsed.json +++ b/test/integration/full-content/fixtures/core__shortcode.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/shortcode", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n[gallery ids=\"238,338\"]\n" + "innerHTML": "\n[gallery ids=\"238,338\"]\n", + "innerContent": [ "\n[gallery ids=\"238,338\"]\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__spacer.parsed.json b/test/integration/full-content/fixtures/core__spacer.parsed.json index 8b8baa2a7fc616..c3c0938df5b9da 100644 --- a/test/integration/full-content/fixtures/core__spacer.parsed.json +++ b/test/integration/full-content/fixtures/core__spacer.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/spacer", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
\n" + "innerHTML": "\n
\n", + "innerContent": [ "\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__subhead.parsed.json b/test/integration/full-content/fixtures/core__subhead.parsed.json index 06ca46da1b88d8..d88b9ee4c90b69 100644 --- a/test/integration/full-content/fixtures/core__subhead.parsed.json +++ b/test/integration/full-content/fixtures/core__subhead.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/subhead", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n

This is a subhead.

\n" + "innerHTML": "\n

This is a subhead.

\n", + "innerContent": [ "\n

This is a subhead.

\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__table.parsed.json b/test/integration/full-content/fixtures/core__table.parsed.json index 8c24b96113b947..7a2d91003f4373 100644 --- a/test/integration/full-content/fixtures/core__table.parsed.json +++ b/test/integration/full-content/fixtures/core__table.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/table", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
VersionMusicianDate
.70No musician chosen.May 27, 2003
1.0Miles DavisJanuary 3, 2004
Lots of versions skipped, see the full list
4.4Clifford BrownDecember 8, 2015
4.5Coleman HawkinsApril 12, 2016
4.6Pepper AdamsAugust 16, 2016
4.7Sarah VaughanDecember 6, 2016
\n" + "innerHTML": "\n
VersionMusicianDate
.70No musician chosen.May 27, 2003
1.0Miles DavisJanuary 3, 2004
Lots of versions skipped, see the full list
4.4Clifford BrownDecember 8, 2015
4.5Coleman HawkinsApril 12, 2016
4.6Pepper AdamsAugust 16, 2016
4.7Sarah VaughanDecember 6, 2016
\n", + "innerContent": [ "\n
VersionMusicianDate
.70No musician chosen.May 27, 2003
1.0Miles DavisJanuary 3, 2004
Lots of versions skipped, see the full list
4.4Clifford BrownDecember 8, 2015
4.5Coleman HawkinsApril 12, 2016
4.6Pepper AdamsAugust 16, 2016
4.7Sarah VaughanDecember 6, 2016
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__text-columns.parsed.json b/test/integration/full-content/fixtures/core__text-columns.parsed.json index 293c930ac59e65..1a7db4e09ed3a3 100644 --- a/test/integration/full-content/fixtures/core__text-columns.parsed.json +++ b/test/integration/full-content/fixtures/core__text-columns.parsed.json @@ -5,12 +5,14 @@ "width": "center" }, "innerBlocks": [], - "innerHTML": "\n
\n
\n

One

\n
\n
\n

Two

\n
\n
\n" + "innerHTML": "\n
\n
\n

One

\n
\n
\n

Two

\n
\n
\n", + "innerContent": [ "\n
\n
\n

One

\n
\n
\n

Two

\n
\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__text__converts-to-paragraph.parsed.json b/test/integration/full-content/fixtures/core__text__converts-to-paragraph.parsed.json index 958d2a29213270..75a5ca1140907a 100644 --- a/test/integration/full-content/fixtures/core__text__converts-to-paragraph.parsed.json +++ b/test/integration/full-content/fixtures/core__text__converts-to-paragraph.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/text", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n

This is an old-style text block. Changed to paragraph in #2135.

\n" + "innerHTML": "\n

This is an old-style text block. Changed to paragraph in #2135.

\n", + "innerContent": [ "\n

This is an old-style text block. Changed to paragraph in #2135.

\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__verse.parsed.json b/test/integration/full-content/fixtures/core__verse.parsed.json index 4f244cb551d50c..4cccc9383a50cb 100644 --- a/test/integration/full-content/fixtures/core__verse.parsed.json +++ b/test/integration/full-content/fixtures/core__verse.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/verse", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
A verse
And more!
\n" + "innerHTML": "\n
A verse
And more!
\n", + "innerContent": [ "\n
A verse
And more!
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ] diff --git a/test/integration/full-content/fixtures/core__video.parsed.json b/test/integration/full-content/fixtures/core__video.parsed.json index 7b448d6f380d9f..e9be9d8a2ea2c0 100644 --- a/test/integration/full-content/fixtures/core__video.parsed.json +++ b/test/integration/full-content/fixtures/core__video.parsed.json @@ -3,12 +3,14 @@ "blockName": "core/video", "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
\n" + "innerHTML": "\n
\n", + "innerContent": [ "\n
\n" ] }, { "blockName": null, "attrs": {}, "innerBlocks": [], - "innerHTML": "\n" + "innerHTML": "\n", + "innerContent": [ "\n" ] } ]