defineContainer
defineContainer<
TType>(config):Container
Defined in: packages/editor/src/renderers/renderer.types.ts:139
Define a container renderer. The returned registration is mounted via
the <ContainerPlugin> wrapper at the top level, or nested inside
another container’s of array as a positional override.
type cannot be 'span' (use defineLeaf) nor 'block' (use
defineTextBlock). The text block is not a container.
The node argument of render narrows to a portable text object.
Type Parameters
Section titled “Type Parameters”TType extends string
Parameters
Section titled “Parameters”config
Section titled “config”childField
Section titled “childField”string
readonly (Container | Leaf | TextBlock)[]
render?
Section titled “render?”(props) => ReactElement<unknown, string | JSXElementConstructor<any>> | null
TType extends "span" ? "Error: defineContainer({type: 'span'}) is forbidden -- 'span' is always a leaf, use defineLeaf" : TType extends "block" ? "Error: defineContainer({type: 'block'}) is forbidden -- 'block' is always a text block, use defineTextBlock" : TType
Returns
Section titled “Returns”Example
Section titled “Example”defineContainer({ type: 'table', childField: 'rows', render: ({children}) => <table>{children}</table>, of: [ defineContainer({ type: 'row', childField: 'cells', render: ({children}) => <tr>{children}</tr>, }), ],})