getUnionSchema
getUnionSchema(
schema,containers):Schema
Defined in: get-union-schema.ts:28
Return a Schema that contains every named member declared anywhere
in the editor’s schema graph that is reachable from a position where text
is edited - the root schema merged with the sub-schema of every registered
container whose field accepts text blocks, deduped by name. Useful for
rendering a static toolbar whose buttons stay stable across selection
moves while still reflecting everything that could plausibly be edited or
inserted somewhere.
Containers whose field does NOT accept text blocks (e.g. a table
container whose rows field only accepts row objects, or a row
container whose cells field only accepts cell objects) are
structural: their immediate of types are organizational, not
insertable user content. Those structural types are excluded from the
union. Their nested text-block-accepting descendants (e.g. a cell
that contains a content field of {type: 'block'}) are reached via
those descendants’ own container registration.
Pair with getPathSubSchema (or a path-based intersection across a
range) to determine which of the union’s members are applicable at the
current selection.
Parameters
Section titled “Parameters”schema
Section titled “schema”Schema
containers
Section titled “containers”Containers
Returns
Section titled “Returns”Schema