diff --git a/src/wp-blocks/core-button.jsx b/src/wp-blocks/core-button.jsx new file mode 100644 index 00000000..be988096 --- /dev/null +++ b/src/wp-blocks/core-button.jsx @@ -0,0 +1,41 @@ +import { gql } from "@apollo/client"; +import { CoreBlocks } from "@faustwp/blocks"; + +const { CoreButton: FaustCoreButton } = CoreBlocks; + +export default function CoreButton(props) { + return ; +} + +CoreButton.displayName = { ...FaustCoreButton.displayName }; +CoreButton.config = { ...FaustCoreButton.config }; + +/** + * Faust's stock fragment requests `attributes.textAlign`, which no longer + * exists on `CoreButtonAttributes` in the CMS schema. GraphQL rejects the + * whole document at validation time, so every blog post 500s. Neither the + * component nor `getStyles` reads `textAlign` (alignment arrives via + * `cssClassName`), so dropping the field changes nothing visually. + */ +CoreButton.fragments = { + key: "CoreButtonBlockFragment", + entry: gql` + fragment CoreButtonBlockFragment on CoreButton { + attributes { + anchor + gradient + text + textColor + style + fontSize + fontFamily + linkTarget + rel + url + backgroundColor + cssClassName + linkClassName + } + } + `, +}; diff --git a/src/wp-blocks/core-heading.jsx b/src/wp-blocks/core-heading.jsx index 8f51ab21..4b23d360 100644 --- a/src/wp-blocks/core-heading.jsx +++ b/src/wp-blocks/core-heading.jsx @@ -1,3 +1,4 @@ +import { gql } from "@apollo/client"; import { CoreBlocks } from "@faustwp/blocks"; import slugify from "@sindresorhus/slugify"; @@ -16,4 +17,30 @@ export default function CoreHeading(props) { CoreHeading.displayName = { ...FaustCoreHeading.displayName }; CoreHeading.config = { ...FaustCoreHeading.config }; -CoreHeading.fragments = { ...FaustCoreHeading.fragments }; +/** + * Faust's stock fragment requests `attributes.textAlign`, which no longer + * exists on `CoreHeadingAttributes` in the CMS schema. GraphQL rejects the + * whole document at validation time, so every blog post 500s. Neither the + * component nor `getStyles` reads `textAlign` (alignment arrives via + * `cssClassName`), so dropping the field changes nothing visually. + */ +CoreHeading.fragments = { + key: "CoreHeadingBlockFragment", + entry: gql` + fragment CoreHeadingBlockFragment on CoreHeading { + attributes { + align + anchor + backgroundColor + content + fontFamily + fontSize + gradient + level + style + textColor + cssClassName + } + } + `, +}; diff --git a/src/wp-blocks/index.js b/src/wp-blocks/index.js index 5e81ed3c..44458e08 100644 --- a/src/wp-blocks/index.js +++ b/src/wp-blocks/index.js @@ -1,9 +1,11 @@ import { CoreBlocks } from "@faustwp/blocks"; +import CoreButton from "./core-button"; import CoreEmbed from "./core-embed"; import CoreHeading from "./core-heading"; export default { ...CoreBlocks, CoreHeading, + CoreButton, CoreEmbed, };