import { registerBlockType, BlockConfiguration, BlockEditProps, BlockSaveProps } from '@wordpress/blocks'; import { BlockFC, ConfigType } from './types/index.js'; import './controls/index.js'; export interface RegisterFaustBlockMetadata> { blockJson: BlockConfiguration; editFn: (ctx: EditFnContext) => React.ReactNode | null; saveFn: (ctx: SaveFnContext) => React.ReactNode | null; } export interface EditFnContext> { block: BlockFC; props: BlockEditProps; wp: unknown; config: ConfigType; blockJson: BlockConfiguration; } export interface SaveFnContext> { block: BlockFC; props: BlockSaveProps; wp: unknown; } /** * The `registerFaustBlock` helper function registers a new React Component into the Gutenberg Editor. * By providing a valid `block.json` and some configuration, this helper function will generate custom `edit` and `save` functions that will be used a parameters to the * [registerBlockType](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/#registerblocktype) function. * * Users can provider their own custom edit or save functions by passing them as parameters to the ctx argument. * Use `editFn` to override the `edit` function and `saveFn` to override the `save` function * * @param block The React component to register as Gutenberg Block. * @param ctx The metadata object that contains the block.json. */ export default function registerFaustBlock>(block: BlockFC, { blockJson, editFn, saveFn, }: RegisterFaustBlockMetadata): ReturnType;