defineTextBlock
defineTextBlock<
TType>(config):TextBlock
Defined in: packages/editor/src/renderers/renderer.types.ts:491
Define a text block renderer. The returned registration is mounted
via the <NodePlugin> component, or nested inside a container’s
of array as a positional override.
type is required even though the top-level text block type is
always 'block'. Keeping type required leaves the door open for
positional overrides of text-block-like elements (e.g. a code-line
inside a code-block container).
Type Parameters
Section titled “Type Parameters”TType extends string
Parameters
Section titled “Parameters”config
Section titled “config”readonly (Span | InlineObject)[]
render?
Section titled “render?”TType extends "span" ? "Error: defineTextBlock({type: 'span'}) is forbidden -- 'span' is always a span, use defineSpan" : TType
Returns
Section titled “Returns”Example
Section titled “Example”defineTextBlock({ type: 'block', render: ({attributes, children}) => ( <p {...attributes}>{children}</p> ),})