defineLeaf
Call Signature
Section titled “Call Signature”defineLeaf<
TSchema>(config):Leaf
Defined in: packages/editor/src/renderers/renderer.types.ts:234
Define a leaf renderer for a span, inline object, or void block object at a given scope.
The render function must always render children somewhere inside the
outer element. For spans children carries the styled text. For inline
objects and void block objects children carries an engine-emitted void
spacer that the browser uses to anchor the caret next to the element. If
the consumer drops children, the caret cannot land on the element.
With a schema type parameter, scope is constrained to valid JSONPath
leaf scopes:
defineLeaf<typeof schema>({ scope: '$..callout.block.span', render: ({attributes, children}) => <span {...attributes}>{children}</span>,})Without a schema type parameter, accepts any string.
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema extends SchemaDefinition
Parameters
Section titled “Parameters”config
Section titled “config”SchemaLeafConfig<TSchema>
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”defineLeaf(
config):Leaf
Defined in: packages/editor/src/renderers/renderer.types.ts:240