34 lines
818 B
TypeScript
34 lines
818 B
TypeScript
import type { Config } from "@puckeditor/core";
|
|
|
|
type Props = {
|
|
HeadingBlock: { title: string };
|
|
RichText: { content: string };
|
|
};
|
|
|
|
const puckConfig: Config<Props> = {
|
|
components: {
|
|
HeadingBlock: {
|
|
fields: {
|
|
title: { type: "text" },
|
|
},
|
|
defaultProps: {
|
|
title: "Heading",
|
|
},
|
|
render: ({ title }) => (
|
|
<div style={{ padding: 64 }}>
|
|
<h1>{title}</h1>
|
|
</div>
|
|
),
|
|
},
|
|
RichText: {
|
|
fields: {
|
|
content: { type: "textarea" },
|
|
},
|
|
render: ({ content }) => (
|
|
<div dangerouslySetInnerHTML={{ __html: content }} />
|
|
),
|
|
},
|
|
},
|
|
};
|
|
|
|
export default puckConfig; |