import type { BlockProperties, Block } from 'grapesjs'; import type { ComponentAppendFallbackResult, DropTargetsFnProps } from './components'; import { WithEditorProps } from './common'; import { RootLayoutConfig } from './layout'; export type BlockAppendOnClickFnProps = Pick; export type BlockAppendOnClickResult = boolean | ComponentAppendFallbackResult; export type BlockAppendOnClickFn = (props: BlockAppendOnClickFnProps) => BlockAppendOnClickResult | Promise; export interface BlocksConfig { /** * Provide an array of additional blocks to be added to the editor. * @example * default: [ * { * id: 'image', * label: 'Image', * media: '', * content: { type: 'image' }, * activate: true, * select: true, * }, * ] */ default?: BlockProperties[]; /** * Globally customize what happens when a block is clicked in the Block Manager. * * Return: * - `false` to prevent any click insertion for the current block. * - `true` to continue with the default append-on-click behavior. * - a `{ target, content }` object to override the insertion target and content. * * @example * appendOnClick: ({ block, root }) => { * if (block.getId() === 'some-block') return false; * * if (block.getId() === 'another-block) { * return { * target: root, * content: { * type: 'some-wrapper', * components: block.getContent(), * } * }; * } * * return true; * } */ appendOnClick?: BlockAppendOnClickFn; } export declare enum BlockType { REGULAR = "regular", SYMBOLS = "symbols" } export type BlockItemLayout = (props: WithEditorProps & { block: Block; attributes: Record; }) => RootLayoutConfig | null;