Rich text / foldkit-mixins-richtext

LinkEditorInput

interface · packages/mixins-richtext/src/link.ts:25

interface LinkEditorInput<Message> {
  readonly document: RichText.Document
  readonly selection: RichText.Selection | null
  readonly draft: string
  readonly drafted: (href: string) => Message
  readonly wrap: (message: EditorEvent) => Message
  readonly closed?: Message | undefined
  readonly submitted?: Message | undefined
}

Members

LinkEditorInput.document

property · packages/mixins-richtext/src/link.ts:26

readonly document: RichText.Document

LinkEditorInput.selection

property · packages/mixins-richtext/src/link.ts:27

readonly selection: RichText.Selection | null

LinkEditorInput.draft

property · packages/mixins-richtext/src/link.ts:29

readonly draft: string

The address as typed so far; RichText.linkAt(...)?.href is what to start it from.

LinkEditorInput.drafted

property · packages/mixins-richtext/src/link.ts:31

readonly drafted: (href: string) => Message

What the field sends as the address changes.

LinkEditorInput.wrap

property · packages/mixins-richtext/src/link.ts:33

readonly wrap: (message: EditorEvent) => Message

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

LinkEditorInput.closed

property · packages/mixins-richtext/src/link.ts:35

readonly closed?: Message | undefined

What Escape in the field sends: usually closing the editor. Without it, Escape does nothing.

LinkEditorInput.submitted

property · packages/mixins-richtext/src/link.ts:41

readonly submitted?: Message | undefined

What Enter in the field sends, for the caller's update to apply linkEdit to its own draft. Without it, Enter sends the edit the view last drew, which is a frame behind keys typed fast: Enter right after the last character would apply the draft before it.