Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#60918 closed defect (bug) (invalid)

parse_blocks stopped returning content and text in attrs in 6.5

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

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
3 years ago

  • Component REST API → Editor
  • Keywords reporter-feedback added
  • Severity major → normal

Is this a bug in core or in the plugin?

cc @spacedmonkey

#2 @olenakuzmenko
3 years 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
3 years 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
3 years 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
2 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → 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.