defineContainer
defineContainer<
TType>(config):Container
Defined in: packages/editor/src/renderers/renderer.types.ts:344
Define a container renderer. The returned registration is mounted via
the <NodePlugin> component at the top level, or nested inside
another container’s of array as a positional override.
type cannot be 'span' (use defineSpan) 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”arrayField
Section titled “arrayField”string
readonly (Container | TextBlock | BlockObject)[]
render?
Section titled “render?”(props) => ReactElement
TType extends "span" ? "Error: defineContainer({type: 'span'}) is forbidden -- 'span' is always a span, use defineSpan" : TType extends "block" ? "Error: defineContainer({type: 'block'}) is forbidden -- 'block' is always a text block, use defineTextBlock" : TType extends "*" ? "Error: defineContainer({type: '*'}) is forbidden -- containers cannot be registered by wildcard" : TType
Returns
Section titled “Returns”Example
Section titled “Example”defineContainer({ type: 'table', arrayField: 'rows', render: ({children}) => ( <table>{children}</table> ), of: [ defineContainer({ type: 'row', arrayField: 'cells', render: ({children}) => ( <tr>{children}</tr> ), }), ],})