Rich text / foldkit-richtext-dom/events

Attachment

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

interface Attachment {
  readonly current: () => EditorDom
  readonly sync: (
    state: RichText.EditorState,
    changeSet: RichText.ChangeSet,
  ) => void
  readonly redecorate: () => void
  readonly focus: (selection: RichText.Selection) => void
  readonly held: () => RichText.Document
  readonly composing: () => boolean
  readonly detach: () => void
}

Members

Attachment.current

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

readonly current: () => EditorDom

The current subtree; replaced as patches are applied.

Attachment.sync

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

readonly sync: (
  state: RichText.EditorState,
  changeSet: RichText.ChangeSet,
) => void

Applies a committed state, patching and restoring the browser selection. While the browser is composing, the latest state waits and is drawn when composition ends.

Attachment.redecorate

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

readonly redecorate: () => void

Draws the decorations again over what is drawn, for when they changed and the document did not, and puts the browser's selection back where it was. Nothing while composing: the next state drawn brings them.

Attachment.focus

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

readonly focus: (selection: RichText.Selection) => void

Takes the focus with the caret or range at selection, scrolled into view when it is out of it: for a control outside the editor that sends the reader into the text, such as a table of contents or a find bar closing on its match.

Attachment.held

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

readonly held: () => RichText.Document

The latest document synced: the one waiting on a composition, or else the one drawn. A patch computed from here to the next state is what brings the subtree up to it.

Attachment.composing

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

readonly composing: () => boolean

True between compositionstart and compositionend.

Attachment.detach

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

readonly detach: () => void