defineInlineObject
defineInlineObject<
TType>(config):InlineObject
Defined in: packages/editor/src/renderers/renderer.types.ts:401
Define a non-editable inline object renderer for a _type declared
in the schema’s inlineObjects array.
The render must always render children somewhere inside the outer
element. children carries an engine-emitted void spacer the browser
uses to anchor the caret next to the element. Dropping children
makes the caret unable to land on the element.
Type Parameters
Section titled “Type Parameters”TType extends string
Parameters
Section titled “Parameters”config
Section titled “config”render?
Section titled “render?”InlineObjectRender | null
TType extends "block" ? "Error: defineInlineObject({type: 'block'}) is forbidden -- 'block' is always a text block, use defineTextBlock" : TType extends "span" ? "Error: defineInlineObject({type: 'span'}) is forbidden -- 'span' is always a span, use defineSpan" : TType
Returns
Section titled “Returns”Example
Section titled “Example”defineInlineObject({ type: 'mention', render: ({attributes, children, node}) => ( <span {...attributes}> {children} @{(node as {username?: string}).username} </span> ),})