Make WordPress Core


Ignore:
Timestamp:
01/04/2019 07:37:30 PM (6 years ago)
Author:
desrosj
Message:

Block Editor: Upgrade @WordPress packages to the latest versions.

Updated packages:

  • @wordpress/annotations@1.0.5
  • @wordpress/api-fetch@2.2.7
  • @wordpress/block-library@2.2.12
  • @wordpress/block-serialization-default-parser@2.0.3
  • @wordpress/blocks@6.0.5
  • @wordpress/components@7.0.5
  • @wordpress/core-data@2.0.16
  • @wordpress/data@4.2.0
  • @wordpress/deprecated@2.0.4
  • @wordpress/dom@2.0.8
  • @wordpress/edit-post@3.1.7
  • @wordpress/editor@9.0.7
  • @wordpress/format-library@1.2.10
  • @wordpress/hooks@2.0.4
  • @wordpress/list-reusable-blocks@1.1.18
  • @wordpress/notices@1.1.2
  • @wordpress/nux@3.0.6
  • @wordpress/plugins@2.0.10
  • @wordpress/rich-text@3.0.4
  • @wordpress/url@2.3.3
  • @wordpress/viewport@2.1.0

Props: youknowriad, gziolo, desrosj.

Fixes #45814.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-parser.php

    r44360 r44389  
    11<?php
     2/**
     3 * Block Serialization Parser
     4 *
     5 * @package WordPress
     6 */
    27
    38/**
     
    6368    public $innerContent;
    6469
     70    /**
     71     * Constructor.
     72     *
     73     * Will populate object properties from the provided arguments.
     74     *
     75     * @since 3.8.0
     76     *
     77     * @param string $name         Name of block.
     78     * @param array  $attrs        Optional set of attributes from block comment delimiters.
     79     * @param array  $innerBlocks  List of inner blocks (of this same class).
     80     * @param string $innerHTML    Resultant HTML from inside block comment delimiters after removing inner blocks.
     81     * @param array  $innerContent List of string fragments and null markers where inner blocks were found.
     82     */
    6583    function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
    6684        $this->blockName    = $name;
     
    122140    public $leading_html_start;
    123141
     142    /**
     143     * Constructor
     144     *
     145     * Will populate object properties from the provided arguments.
     146     *
     147     * @since 3.8.0
     148     *
     149     * @param WP_Block_Parser_Block $block              Full or partial block.
     150     * @param int                   $token_start        Byte offset into document for start of parse token.
     151     * @param int                   $token_length       Byte length of entire parse token string.
     152     * @param int                   $prev_offset        Byte offset into document for after parse token ends.
     153     * @param int                   $leading_html_start Byte offset into document where leading HTML before token starts.
     154     */
    124155    function __construct( $block, $token_start, $token_length, $prev_offset = null, $leading_html_start = null ) {
    125156        $this->block              = $block;
     
    191222     * @since 3.8.0
    192223     *
    193      * @param string $document
     224     * @param string $document Input document being parsed.
    194225     * @return WP_Block_Parser_Block[]
    195226     */
     
    202233
    203234        do {
    204             // twiddle our thumbs
     235            // twiddle our thumbs.
    205236        } while ( $this->proceed() );
    206237
     
    227258        $stack_depth = count( $this->stack );
    228259
    229         // we may have some HTML soup before the next block
     260        // we may have some HTML soup before the next block.
    230261        $leading_html_start = $start_offset > $this->offset ? $this->offset : null;
    231262
    232263        switch ( $token_type ) {
    233264            case 'no-more-tokens':
    234                 // if not in a block then flush output
     265                // if not in a block then flush output.
    235266                if ( 0 === $stack_depth ) {
    236267                    $this->add_freeform();
     
    247278                 */
    248279
    249                 // for the easy case we'll assume an implicit closer
     280                // for the easy case we'll assume an implicit closer.
    250281                if ( 1 === $stack_depth ) {
    251282                    $this->add_block_from_stack();
     
    284315                }
    285316
    286                 // otherwise we found an inner block
     317                // otherwise we found an inner block.
    287318                $this->add_inner_block(
    288319                    new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
     
    294325
    295326            case 'block-opener':
    296                 // track all newly-opened blocks on the stack
     327                // track all newly-opened blocks on the stack.
    297328                array_push(
    298329                    $this->stack,
     
    324355                }
    325356
    326                 // if we're not nesting then this is easy - close the block
     357                // if we're not nesting then this is easy - close the block.
    327358                if ( 1 === $stack_depth ) {
    328359                    $this->add_block_from_stack( $start_offset );
     
    351382
    352383            default:
    353                 // This is an error
     384                // This is an error.
    354385                $this->add_freeform();
    355386                return false;
     
    387418        );
    388419
    389         // if we get here we probably have catastrophic backtracking or out-of-memory in the PCRE
     420        // if we get here we probably have catastrophic backtracking or out-of-memory in the PCRE.
    390421        if ( false === $has_match ) {
    391422            return array( 'no-more-tokens', null, null, null, null );
    392423        }
    393424
    394         // we have no more tokens
     425        // we have no more tokens.
    395426        if ( 0 === $has_match ) {
    396427            return array( 'no-more-tokens', null, null, null, null );
     
    420451         */
    421452        if ( $is_closer && ( $is_void || $has_attrs ) ) {
    422             // we can ignore them since they don't hurt anything
     453            // we can ignore them since they don't hurt anything.
    423454        }
    424455
     
    440471     * @since 3.9.0
    441472     *
    442      * @param string $innerHTML HTML content of block
    443      * @return WP_Block_Parser_Block freeform block object
     473     * @param string $innerHTML HTML content of block.
     474     * @return WP_Block_Parser_Block freeform block object.
    444475     */
    445476    function freeform( $innerHTML ) {
     
    449480    /**
    450481     * Pushes a length of text from the input document
    451      * to the output list as a freeform block
     482     * to the output list as a freeform block.
    452483     *
    453484     * @internal
    454485     * @since 3.8.0
    455      * @param null $length how many bytes of document text to output
     486     * @param null $length how many bytes of document text to output.
    456487     */
    457488    function add_freeform( $length = null ) {
     
    467498    /**
    468499     * Given a block structure from memory pushes
    469      * a new block to the output list
     500     * a new block to the output list.
    470501     *
    471502     * @internal
    472503     * @since 3.8.0
    473      * @param WP_Block_Parser_Block $block the block to add to the output
    474      * @param int $token_start byte offset into the document where the first token for the block starts
    475      * @param int $token_length byte length of entire block from start of opening token to end of closing token
    476      * @param int|null $last_offset last byte offset into document if continuing form earlier output
     504     * @param WP_Block_Parser_Block $block        The block to add to the output.
     505     * @param int                   $token_start  Byte offset into the document where the first token for the block starts.
     506     * @param int                   $token_length Byte length of entire block from start of opening token to end of closing token.
     507     * @param int|null              $last_offset  Last byte offset into document if continuing form earlier output.
    477508     */
    478509    function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
     
    491522
    492523    /**
    493      * Pushes the top block from the parsing stack to the output list
     524     * Pushes the top block from the parsing stack to the output list.
    494525     *
    495526     * @internal
    496527     * @since 3.8.0
    497      * @param int|null $end_offset byte offset into document for where we should stop sending text output as HTML
     528     * @param int|null $end_offset byte offset into document for where we should stop sending text output as HTML.
    498529     */
    499530    function add_block_from_stack( $end_offset = null ) {
Note: See TracChangeset for help on using the changeset viewer.