spacedmonkey / wp-rest-blocks

Add gutenberg blocks data into post / page / widget REST API endpoints.

Home Page:https://wordpress.org/plugins/rest-api-blocks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`core/table` block not populating block attributes `head`, `body` and `foot` on rest API

lagset opened this issue · comments

Version

Wordpress 5.7.2

Problem

When using the core/table block on a post and filling it with data as well as enabling header and footer rows and saving the rest api does not fill the corresponding block attributes properties with data, e.g.:

{
        "blockName": "core/table",
        "attrs": {
          "className": "is-style-stripes",
          "hasFixedLayout": false,
          "caption": "Table Caption",
          "head": [],
          "body": [],
          "foot": [],
          "anchor": ""
        },
        "innerBlocks": [],
        "innerHTML": "\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>Header 1</th><th class=\"has-text-align-left\" data-align=\"left\">Header 2</th><th>Header 3</th><th>Header 4</th></tr></thead><tbody><tr><td>First Cell</td>...",
        "innerContent": [
          "\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>Header 1</th><th class=\"has-text-align-left\" data-align=\"left\">Header 2</th><th>Header 3</th><th>Header 4</th></tr></thead><tbody><tr><td>First Cell</td>..."
        ],
        "rendered": "\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>Header 1</th><th class=\"has-text-align-left\" data-align=\"left\">Header 2</th><th>Header 3</th><th>Header 4</th></tr></thead><tbody><tr><td>First Cell</td>..."
      },

I would expect the fields attrs.head, attrs.body, attrs.foot to be filled with data of the corresponding cells. Or am I wrong here?


By the way, I am using the plugin to expose the blocks of a post/page to a nuxt frontend and render each block as a vue component. So far it works pretty good, thanks for making this!

@lagset Can you take a look at #18. See if it fixes the issue for you.

@spacedmonkey I can confirm it is working on my Wordpress 5.7.2 development install. Thanks for fixing this, much appreciated!