diff --git a/.changeset/spicy-doors-lie.md b/.changeset/spicy-doors-lie.md
new file mode 100644
index 000000000..5dea8d8fc
--- /dev/null
+++ b/.changeset/spicy-doors-lie.md
@@ -0,0 +1,5 @@
+---
+'@faustwp/blocks': major
+---
+
+**BREAKING**: Make `attributes` field on core blocks optional to comply with the `WordPressBlock` type interface. Thanks @traed!
diff --git a/packages/blocks/src/blocks/CoreButton.tsx b/packages/blocks/src/blocks/CoreButton.tsx
index 29fb16d71..02a8a32f7 100644
--- a/packages/blocks/src/blocks/CoreButton.tsx
+++ b/packages/blocks/src/blocks/CoreButton.tsx
@@ -6,7 +6,7 @@ import { ContentBlock } from '../components/WordPressBlocksViewer.js';
import { getStyles } from '../utils/index.js';
export type CoreButtonFragmentProps = ContentBlock & {
- attributes: {
+ attributes?: {
anchor?: string;
backgroundColor?: string;
cssClassName?: string;
@@ -28,7 +28,7 @@ export function CoreButton(props: CoreButtonFragmentProps) {
const theme = useBlocksTheme();
const style = getStyles(theme, { ...props });
const { attributes } = props;
- const linkTarget = attributes.linkTarget ? '_blank' : undefined;
+ const linkTarget = attributes?.linkTarget ? '_blank' : undefined;
if (attributes?.url) {
return (
) {
const { attributes, children } = props;
- if (!attributes.href) {
+ if (!attributes?.href) {
/**
* Fragment is used to fix the following TS error:
* 'LinkWrapper' cannot be used as a JSX component.
@@ -66,7 +66,7 @@ function ImgWrapper(props: PropsWithChildren
) {
const style = getStyles(theme, { ...props });
const { attributes } = props;
- if (!attributes.src) {
+ if (!attributes?.src) {
return null;
}
diff --git a/packages/blocks/src/blocks/CoreList.tsx b/packages/blocks/src/blocks/CoreList.tsx
index d2041807d..ea8176c8f 100644
--- a/packages/blocks/src/blocks/CoreList.tsx
+++ b/packages/blocks/src/blocks/CoreList.tsx
@@ -5,7 +5,7 @@ import { ContentBlock } from '../components/WordPressBlocksViewer.js';
import { getStyles } from '../utils/index.js';
export type CoreListFragmentProps = ContentBlock & {
- attributes: {
+ attributes?: {
anchor?: string;
backgroundColor?: string;
className?: string;
diff --git a/packages/blocks/src/blocks/CoreParagraph.tsx b/packages/blocks/src/blocks/CoreParagraph.tsx
index edf405348..e6c5bda69 100644
--- a/packages/blocks/src/blocks/CoreParagraph.tsx
+++ b/packages/blocks/src/blocks/CoreParagraph.tsx
@@ -7,7 +7,7 @@ import { useBlocksTheme } from '../components/WordPressBlocksProvider.js';
import { ContentBlock } from '../components/WordPressBlocksViewer.js';
export type CoreParagraphFragmentProps = ContentBlock & {
- attributes: {
+ attributes?: {
cssClassName?: string;
backgroundColor?: string;
content?: string;
diff --git a/packages/blocks/src/blocks/CoreQuote.tsx b/packages/blocks/src/blocks/CoreQuote.tsx
index 474fa2acb..f74860aa9 100644
--- a/packages/blocks/src/blocks/CoreQuote.tsx
+++ b/packages/blocks/src/blocks/CoreQuote.tsx
@@ -5,7 +5,7 @@ import { ContentBlock } from '../components/WordPressBlocksViewer.js';
import { getStyles } from '../utils/index.js';
export type CoreQuoteFragmentProps = ContentBlock & {
- attributes: {
+ attributes?: {
align?: string;
anchor?: string;
backgroundColor?: string;
@@ -27,19 +27,19 @@ export function CoreQuote(props: CoreQuoteFragmentProps) {
const style = getStyles(theme, { ...props });
const { attributes } = props;
- if (!attributes.value) {
+ if (!attributes?.value) {
return null;
}
let innerHtml = attributes.value;
- if (attributes.citation) {
+ if (attributes?.citation) {
innerHtml += `${attributes.citation}`;
}
return (