Skip to content

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).

TType extends string

readonly (Span | InlineObject)[]

TextBlockRender

TType extends "span" ? "Error: defineTextBlock({type: 'span'}) is forbidden -- 'span' is always a span, use defineSpan" : TType

TextBlock

defineTextBlock({
type: 'block',
render: ({attributes, children}) => (
<p {...attributes}>{children}</p>
),
})