Rich text / foldkit-mixins-richtext

FormattingToolbarInput

interface · packages/mixins-richtext/src/formatting.ts:188

interface FormattingToolbarInput<Message> {
  readonly id: string
  readonly document: RichText.Document
  readonly selection: RichText.Selection | null
  readonly storedMarks?: ReadonlyArray<string> | null | undefined
  readonly wrap: (message: EditorEvent) => Message
  readonly items?: ReadonlyArray<FormattingItem<NoInfer<Message>>> | undefined
  readonly compact?: boolean | undefined
  readonly history?:
    | {
        readonly undo: boolean
        readonly redo: boolean
      }
    | undefined
  readonly menu?: FormattingMenu | undefined
  readonly toggled: (menu: FormattingMenu, open: boolean) => NoInfer<Message>
  readonly inserts?: ReadonlyArray<InsertEntry<NoInfer<Message>>> | undefined
  readonly returned?: NoInfer<Message> | undefined
  readonly roving: RovingTabindex.Model
  readonly onFocus: (id: string) => NoInfer<Message>
  readonly shortcuts?: Readonly<Record<string, string>> | undefined
  readonly words?: Partial<FormattingWords> | undefined
  readonly direction?: 'ltr' | 'rtl' | undefined
}

Members

FormattingToolbarInput.id

property · packages/mixins-richtext/src/formatting.ts:190

readonly id: string

Prefixes the ids the controls draw, which the arrows move focus by; unique on the page.

FormattingToolbarInput.document

property · packages/mixins-richtext/src/formatting.ts:191

readonly document: RichText.Document

FormattingToolbarInput.selection

property · packages/mixins-richtext/src/formatting.ts:192

readonly selection: RichText.Selection | null

FormattingToolbarInput.storedMarks

property · packages/mixins-richtext/src/formatting.ts:194

readonly storedMarks?: ReadonlyArray<string> | null | undefined

The caret's pending format, which wins over the run under it (ToolbarState).

FormattingToolbarInput.wrap

property · packages/mixins-richtext/src/formatting.ts:196

readonly wrap: (message: EditorEvent) => Message

An editor Message as this caller's, usually its edited(...) wrapper.

FormattingToolbarInput.items

property · packages/mixins-richtext/src/formatting.ts:198

readonly items?: ReadonlyArray<FormattingItem<NoInfer<Message>>> | undefined

The controls and their order; default standardFormattingItems. Leave a control out to hide it.

FormattingToolbarInput.compact

property · packages/mixins-richtext/src/formatting.ts:204

readonly compact?: boolean | undefined

Draw only the controls not marked { low }, and the rest in a "More" menu: the application's answer to a narrow screen, from the width signal it keeps in its Model (a media-query Subscription, or a Resize mount on the bar's own column). Default false.

FormattingToolbarInput.history

property · packages/mixins-richtext/src/formatting.ts:209

readonly history?:
  | {
      readonly undo: boolean
      readonly redo: boolean
    }
  | undefined

Whether undo and redo apply. The editor cannot know what the application undoes (a page may undo only this tab's own steps), so the caller says. Default: both available.

property · packages/mixins-richtext/src/formatting.ts:211

readonly menu?: FormattingMenu | undefined

The menu that is open, if any.

FormattingToolbarInput.toggled

property · packages/mixins-richtext/src/formatting.ts:213

readonly toggled: (menu: FormattingMenu, open: boolean) => NoInfer<Message>

What a menu's trigger sends: open (true) or close (false) that menu. Also what Escape sends.

FormattingToolbarInput.inserts

property · packages/mixins-richtext/src/formatting.ts:219

readonly inserts?: ReadonlyArray<InsertEntry<NoInfer<Message>>> | undefined

What the insert menu lists, in order: the slash menu's own entries (InsertEntry.Editor, sent through wrap, so the two never disagree) and the application's (InsertEntry.App, sent as they are). Default: the editor's own blocks (group: 'Blocks').

FormattingToolbarInput.returned

property · packages/mixins-richtext/src/formatting.ts:225

readonly returned?: NoInfer<Message> | undefined

What Escape sends from a control when it closes no popup: usually a Message whose update runs the editor's focus Command, so Escape returns to the text, as in a conventional toolbar. Without it Escape does nothing there.

FormattingToolbarInput.roving

property · packages/mixins-richtext/src/formatting.ts:227

readonly roving: RovingTabindex.Model

Where the one tab stop is: the caller's RovingTabindex.Model, as for foldkit-mixins-ui's Toolbar.

FormattingToolbarInput.onFocus

property · packages/mixins-richtext/src/formatting.ts:229

readonly onFocus: (id: string) => NoInfer<Message>

Sent with a control's id when it takes focus, by a key or a press; answer it by storing the id as roving.current.

FormattingToolbarInput.shortcuts

property · packages/mixins-richtext/src/formatting.ts:231

readonly shortcuts?: Readonly<Record<string, string>> | undefined

Pattern (mod+u) by control id (mark-Underline, link) for chords the application's keymap binds.

FormattingToolbarInput.words

property · packages/mixins-richtext/src/formatting.ts:232

readonly words?: Partial<FormattingWords> | undefined

FormattingToolbarInput.direction

property · packages/mixins-richtext/src/formatting.ts:234

readonly direction?: 'ltr' | 'rtl' | undefined

Default ltr; rtl swaps ArrowLeft and ArrowRight.