Make WordPress Core

Opened 7 months ago

Closed 4 months ago

#60918 closed defect (bug) (invalid)

parse_blocks stopped returning content and text in attrs in 6.5

Reported by: olenakuzmenko's profile olenakuzmenko Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.5
Component: Editor Keywords: reporter-feedback
Focuses: Cc:

Description

parse_blocks stopped returning content and text in attrs in 6.5

We are using wp-rest-blocks to process WordPress article in our system. With version 6.5, there is a new issue discovered https://github.com/spacedmonkey/wp-rest-blocks/issues/69(https://github.com/spacedmonkey/wp-rest-blocks/issues/69)

Taking a look at it, parse_blocks method stopped returning text and content for paragraphs/buttons/list items/probably other components as well.

Example of what we receive for the paragraph now:

    [10] => Array
        (
            [blockName] => core/paragraph
            [attrs] => Array
                (
                )

            [innerBlocks] => Array
                (
                )

            [innerHTML] => 
<p>some <strong>another</strong> <em>paragraph</em> block with <a href="https://jsonformatter.curiousconcept.com/">formatting</a>, a lot of <mark style="background-color:#af1685;color:#e37bc7" class="has-inline-color">formatting</mark>! </p>

            [innerContent] => Array
                (
                    [0] => 
<p>some <strong>another</strong> <em>paragraph</em> block with <a href="https://jsonformatter.curiousconcept.com/">formatting</a>, a lot of <mark style="background-color:#af1685;color:#e37bc7" class="has-inline-color">formatting</mark>! </p>

                )

        )

What we expect to receive:

    [10] => Array
        (
            [blockName] => core/paragraph
            [attrs] => Array
                (
                 [content] => some <strong>another</strong> <em>paragraph</em> block with <a href=\"https://jsonformatter.curiousconcept.com/\">formatting</a>, a lot of <mark style=\"background-color:#af1685;color:#e37bc7\" class=\"has-inline-color\">formatting</mark>! 
                )

            [innerBlocks] => Array
                (
                )

            [innerHTML] => 
<p>some <strong>another</strong> <em>paragraph</em> block with <a href="https://jsonformatter.curiousconcept.com/">formatting</a>, a lot of <mark style="background-color:#af1685;color:#e37bc7" class="has-inline-color">formatting</mark>! </p>

            [innerContent] => Array
                (
                    [0] => 
<p>some <strong>another</strong> <em>paragraph</em> block with <a href="https://jsonformatter.curiousconcept.com/">formatting</a>, a lot of <mark style="background-color:#af1685;color:#e37bc7" class="has-inline-color">formatting</mark>! </p>

                )

        )

I am putting a major severity on it, as it blocks completely our system.

Change History (5)

#1 @swissspidy
7 months ago

  • Component changed from REST API to Editor
  • Keywords reporter-feedback added
  • Severity changed from major to normal

Is this a bug in core or in the plugin?

cc @spacedmonkey

#2 @olenakuzmenko
7 months ago

Hi @swissspidy , it's a bug in the core. The plugin simply takes whatever is returned back by parse_blocks method and returns it back in JSON. Since there is nothing returned in "content" and "text" fields, the plugin doesn't return anything back, which is the correct behaviour for it.

#3 @spacedmonkey
7 months ago

Hey @olenakuzmenko. It is a mixture of a change in core and the plugin not being updated. In WP 6.5, there is a new attribute type of rich-text. The attributes highlight use this new attribute type. So the change was undocumented in the release notes, so I didn't update my plugin. I have a PR now, so if you want help test, I will cut a new release.

#4 @olenakuzmenko
7 months ago

@spacedmonkey , thank you for the investigation! I tested your PR and the changes look good to me, all work as expected with them.

#5 @talldanwp
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

As mentioned, this doesn't seem to be a bug but that the implementation for some blocks changed. I'll close the ticket.

Note: See TracTickets for help on using tickets.