Rich text / foldkit-richtext-dom/events

AttachOptions

interface · packages/richtext-dom/src/events.ts:217

interface AttachOptions {
  readonly onIntent: (command: RichText.Command) => void
  readonly onHistory?: (direction: 'undo' | 'redo') => void
  readonly onSelection?: (selection: RichText.Selection | null) => void
  readonly kit?: RichText.Kit | undefined
  readonly keymap?: ReadonlyArray<KeyBinding> | undefined
  readonly decorate?: Decorate | undefined
  readonly placeholder?: string | undefined
  readonly lineHint?: string | undefined
  readonly nodes?: RichText.NodeRegistry | undefined
  readonly onAction?:
    ((node: RichText.NodeId, action: string) => void) | undefined
}

Members

AttachOptions.onIntent

property · packages/richtext-dom/src/events.ts:219

readonly onIntent: (command: RichText.Command) => void

Called with each semantic command the browser produced.

AttachOptions.onHistory

property · packages/richtext-dom/src/events.ts:221

readonly onHistory?: (direction: 'undo' | 'redo') => void

Called for undo and redo, which are editor intents rather than commands.

AttachOptions.onSelection

property · packages/richtext-dom/src/events.ts:227

readonly onSelection?: (selection: RichText.Selection | null) => void

Called when the caret or range moves to a position the application did not just commit. Without it the editor never learns where the caret is; the adapter cannot follow a selection it is not told about.

AttachOptions.kit

property · packages/richtext-dom/src/events.ts:232

readonly kit?: RichText.Kit | undefined

When given, imported HTML is constrained to this vocabulary: a node kind the Kit does not declare is degraded to a paragraph, never kept.

AttachOptions.keymap

property · packages/richtext-dom/src/events.ts:234

readonly keymap?: ReadonlyArray<KeyBinding> | undefined

Chords the application adds or overrides, checked before the built-ins.

AttachOptions.decorate

property · packages/richtext-dom/src/events.ts:239

readonly decorate?: Decorate | undefined

What is drawn over the document (§129), derived from it each time it is synced — code highlighting, say. A pure read: it sees the document and nothing else.

AttachOptions.placeholder

property · packages/richtext-dom/src/events.ts:241

readonly placeholder?: string | undefined

What a blank document shows (RichText.isBlank): "Write something…".

AttachOptions.lineHint

property · packages/richtext-dom/src/events.ts:247

readonly lineHint?: string | undefined

What the empty paragraph a collapsed caret is in shows, as data-hint on it, which a stylesheet draws as it draws the placeholder (usually only while the editor has the focus). A blank document's block shows the placeholder instead.

AttachOptions.nodes

property · packages/richtext-dom/src/events.ts:252

readonly nodes?: RichText.NodeRegistry | undefined

The node vocabulary, which says where Tab means something (RichText.takesTab): code and table cells take it as Indent and Outdent; anywhere else it moves focus as it always does.

AttachOptions.onAction

property · packages/richtext-dom/src/events.ts:254

readonly onAction?:
  ((node: RichText.NodeId, action: string) => void) | undefined

Called with a block and an adornment's action when that adornment is clicked.