Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/wp-blocks/core-button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { gql } from "@apollo/client";
import { CoreBlocks } from "@faustwp/blocks";

const { CoreButton: FaustCoreButton } = CoreBlocks;

export default function CoreButton(props) {
return <FaustCoreButton {...props} />;
}

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
}
}
`,
};
29 changes: 28 additions & 1 deletion src/wp-blocks/core-heading.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { gql } from "@apollo/client";
import { CoreBlocks } from "@faustwp/blocks";
import slugify from "@sindresorhus/slugify";

Expand All @@ -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
}
}
`,
};
2 changes: 2 additions & 0 deletions src/wp-blocks/index.js
Original file line number Diff line number Diff line change
@@ -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,
};
Loading