coerceBlockToDefinition
coerceBlockToDefinition(
props):object
Defined in: packages/core/src/fields/blocks/utils.ts:101
Coerces an arbitrary object (e.g. pasted from the block clipboard) into a
valid block of blockDef’s shape: a fresh id, keys blockDef does not
declare dropped, and keys it declares but block is missing filled with
their field default. blockName is kept when present and a string. Every
nested block reachable through blockDef’s own fields also gets a fresh id.
Parameters
Section titled “Parameters”Input props.
Record<string, unknown>
The untrusted candidate block object.
blockDef
Section titled “blockDef”The target field’s block type definition to coerce against.
Returns
Section titled “Returns”object
The coerced block plus the keys from block that were dropped.
block:
GenericBlock
droppedKeys
Section titled “droppedKeys”droppedKeys:
string[]