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

Allow querying data on CoreFootnotes #255

Open
erikhartin opened this issue Jul 21, 2024 · 1 comment
Open

Allow querying data on CoreFootnotes #255

erikhartin opened this issue Jul 21, 2024 · 1 comment
Assignees
Labels
status: actionable Ready for work to begin type: bug Issue that causes incorrect or unexpected behavior type: enhancement Improvements to existing functionality

Comments

@erikhartin
Copy link

erikhartin commented Jul 21, 2024

Querying CoreFootnotes (a newish block as of WP 6.1 I believe) in the current version of wp-graphql-content-blocks returns no data. I don't know how Gutenberg stores the footnotes but it would be nice to be able to query them.

To reproduce, using a stock WP 6.6.0, create a post and insert a footnote. then query it using the following query

query PageContent {
  posts {
    nodes {
      id
      editorBlocks {
        ... on CoreFootnotes {
          apiVersion
          blockEditorCategoryName
          renderedHtml
          attributes {
            backgroundColor
            borderColor
            className
            fontFamily
            fontSize
            lock
            metadata
            style
            textColor
          }
          clientId
          cssClassNames
          isDynamic
          name
          parentClientId
          innerBlocks {
            name
            renderedHtml
          }
        }
        ... on CoreParagraph {
          anchor
          apiVersion
          attributes {
            content
          }
          name
        }
      }
    }
  }
}

For illustration I've queried every single field on CoreFootnotes.

The data returned is

{
  "data": {. 
    "posts": {. 
      "nodes": [
        {
          "id": "cG9zdDoxNg==",
          "editorBlocks": [
            {
              "anchor": null,
              "apiVersion": 3,
              "attributes": {
                "content": "hello hello<sup data-fn=\"384894a0-a54e-4b31-91f5-927e3526a5d3\" class=\"fn\"><a id=\"384894a0-a54e-4b31-91f5-927e3526a5d3-link\" href=\"#384894a0-a54e-4b31-91f5-927e3526a5d3\">1</a></sup>!"
              },
              "name": "core/paragraph"
            },
            {
              "anchor": null,
              "apiVersion": 3,
              "attributes": {
                "content": "Another block"
              },
              "name": "core/paragraph"
            },
            {
              "apiVersion": 3,
              "blockEditorCategoryName": "text",
              "renderedHtml": "",
              "attributes": {
                "backgroundColor": null,
                "borderColor": null,
                "className": null,
                "fontFamily": null,
                "fontSize": null,
                "lock": null,
                "metadata": null,
                "style": null,
                "textColor": null
              },
              "clientId": "669cb9b683b95",
              "cssClassNames": null,
              "isDynamic": true,
              "name": "core/footnotes",
              "parentClientId": null,
              "innerBlocks": []
            }
          ]
        },
        {
          "id": "cG9zdDox",
          "editorBlocks": [
            {
              "anchor": null,
              "apiVersion": 3,
              "attributes": {
                "content": "Welcome to WordPress. This is your first post. Edit or delete it, then start writing!"
              },
              "name": "core/paragraph"
            }
          ]
        }
      ]
    }
  },
  "extensions": {
    "debug": [],
    "queryAnalyzer": {
      "keys": "1aaf11c676d6acbfcfdb1d4bcd9b3e8e51453b9f24b8ef7d8c3070293c8bcdfd graphql:Query operation:PageContent list:post cG9zdDoxNg== cG9zdDox",
      "keysLength": 132,
      "keysCount": 6,
      "skippedKeys": "",
      "skippedKeysSize": 0,
      "skippedKeysCount": 0,
      "skippedTypes": []
    }
  }
}

One would expect at least renderedHtml to return the actual content of the footnote, but no dice.

Could this be supported? Footnotes are surprisingly useful and I'm happy WP finally added it as a core feature.

@jasonbahl jasonbahl added the needs: reproduction This issue needs to be reproduced independently label Jul 30, 2024
@josephfusco josephfusco added status: actionable Ready for work to begin type: enhancement Improvements to existing functionality and removed needs: reproduction This issue needs to be reproduced independently labels Jan 7, 2025
@colinmurphy colinmurphy self-assigned this Jan 14, 2025
@colinmurphy
Copy link
Contributor

Thanks @erikhartin

Thank you for raising this issue. We will look at adding support for this block type.

@colinmurphy colinmurphy added the type: bug Issue that causes incorrect or unexpected behavior label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: actionable Ready for work to begin type: bug Issue that causes incorrect or unexpected behavior type: enhancement Improvements to existing functionality
Projects
None yet
Development

No branches or pull requests

4 participants