Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lagset opened this issue Jul 8, 2021 · 2 comments · Fixed by #18
Closed

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

lagset opened this issue Jul 8, 2021 · 2 comments · Fixed by #18
Assignees
Labels
bug Something isn't working

Comments

@lagset
Copy link

lagset commented Jul 8, 2021

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!

@spacedmonkey spacedmonkey self-assigned this Aug 8, 2021
@spacedmonkey spacedmonkey added the bug Something isn't working label Aug 8, 2021
@spacedmonkey
Copy link
Owner

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

@lagset
Copy link
Author

lagset commented Aug 16, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants