import React from 'react'; import type { BlockEditProps } from '@plone/types'; type BlocksApiValue = Pick< BlockEditProps, 'id' | 'data' | 'type' | 'onChangeBlock' | 'onInsertBlock' | 'onSelectBlock' >; const BlocksApiContext = React.createContext(null); export const BlocksApiProvider = ({ value, children, }: React.PropsWithChildren<{ value: BlocksApiValue }>) => { return ( {children} ); }; export const useBlocksApi = () => { const context = React.useContext(BlocksApiContext); if (!context) { throw new Error('BlocksApiContext is missing'); } return context; };