Composition / foldkit-builder

BuilderCommand

interface · packages/builder/src/index.ts:702

interface BuilderCommand {
  readonly id: string
  readonly label: string
  readonly keys: ReadonlyArray<CommandKey>
  readonly placement: ReadonlyArray<'node' | 'toolbar' | 'keyboard'>
  readonly run: (
    model: Pick<Model, 'page' | 'selected'>,
  ) => Option.Option<Message>
}

One thing the editor does, and every way to ask for it.

Members

BuilderCommand.id

property · packages/builder/src/index.ts:703

readonly id: string

BuilderCommand.label

property · packages/builder/src/index.ts:705

readonly label: string

What it is called, on its button and in the list of shortcuts.

BuilderCommand.keys

property · packages/builder/src/index.ts:707

readonly keys: ReadonlyArray<CommandKey>

The keys that run it; the first is the one shown. None for one run only by a button.

BuilderCommand.placement

property · packages/builder/src/index.ts:709

readonly placement: ReadonlyArray<'node' | 'toolbar' | 'keyboard'>

Where a drawn Builder offers it: with the selected node's actions, in the toolbar, or by key only.

BuilderCommand.run

property · packages/builder/src/index.ts:711

readonly run: (
  model: Pick<Model, 'page' | 'selected'>,
) => Option.Option<Message>

The Message it sends now; none while it has nothing to do, which disables its button.