tuil
ReferencePackages@mwillbanks/tuil-editorAPI

EditorSession

interface exported by @mwillbanks/tuil-editor.

View rawEdit

interface

Public interface exported by @mwillbanks/tuil-editor.

export interface EditorSession {
  snapshot(): EditorSnapshot;
  dispatch(transaction: EditorTransaction): EditorSnapshot;
  execute(
    command: string | EditorCommand,
    argument?: unknown,
  ): boolean | Promise<boolean>;
  undo(): boolean;
  redo(): boolean;
  search(query: string | RegExp): readonly EditorRange[];
  replace(query: string | RegExp, replacement: string, all?: boolean): number;
  copy(): string | Promise<string>;
  cut(): string | Promise<string>;
  paste(value?: string): boolean | Promise<boolean>;
  serialize(format?: "text" | "json" | "markdown"): string;
  subscribe(observer: (snapshot: EditorSnapshot) => void): () => void;
  key?(input: string): boolean;
  dispose(): void;
}

Members

MemberTypeRequiredDescriptionRelated types
snapshot() => EditorSnapshotYesThe snapshot member uses the () => EditorSnapshot contract.EditorSnapshot
dispatch(transaction: EditorTransaction) => EditorSnapshotYesThe dispatch member uses the (transaction: EditorTransaction) => EditorSnapshot contract.EditorSnapshot, EditorTransaction
execute(command: string | EditorCommand, argument?: unknown) => boolean | Promise<boolean>YesThe execute member uses the (command: string | EditorCommand, argument?: unknown) => boolean | Promise<boolean> contract.EditorCommand
undo() => booleanYesThe undo member uses the () => boolean contract.
redo() => booleanYesThe redo member uses the () => boolean contract.
search(query: string | RegExp) => readonly EditorRange[]YesThe search member uses the (query: string | RegExp) => readonly EditorRange[] contract.EditorRange
replace(query: string | RegExp, replacement: string, all?: boolean) => numberYesThe replace member uses the (query: string | RegExp, replacement: string, all?: boolean) => number contract.
copy() => string | Promise<string>YesThe copy member uses the () => string | Promise<string> contract.
cut() => string | Promise<string>YesThe cut member uses the () => string | Promise<string> contract.
paste(value?: string) => boolean | Promise<boolean>YesThe paste member uses the (value?: string) => boolean | Promise<boolean> contract.
serialize(format?: "text" | "json" | "markdown") => stringYesThe serialize member uses the (format?: "text" | "json" | "markdown") => string contract.
subscribe(observer: (snapshot: EditorSnapshot) => void) => () => voidYesThe subscribe member uses the (observer: (snapshot: EditorSnapshot) => void) => () => void contract.EditorSnapshot
key((input: string) => boolean) | undefinedNoThe key member uses the ((input: string) => boolean) | undefined contract.
dispose() => voidYesThe dispose member uses the () => void contract.

Parameters

This declaration has no public members.

Returns

This declaration does not return a value.

Throws

No thrown errors are documented for this declaration.

Source

View the secondary source reference

Package

@mwillbanks/tuil-editor

On this page