Skip to content

prosekit/core/test

TestEditor

An editor for testing purposes.

constructor

new TestEditor<E extends Extension<ExtensionTyping<any, any, any>>>(instance: EditorInstance): TestEditor<E>

get commands(): ToCommandAction<{[KeyType in string | number | symbol]: UnionToIntersection<ExtractTyping<E>["Commands"] extends undefined ? never : ExtractTyping<E>["Commands"]>[KeyType]}>

All CommandActions defined by the editor.

get focused(): boolean

Whether the editor is focused.

get marks(): ToMarkAction<SimplifyDeeper<{[KeyType in string | number | symbol]: UnionToIntersection<ExtractTyping<E>["Marks"] extends undefined ? never : ExtractTyping<E>["Marks"]>[KeyType]}>>

All MarkActions defined by the editor.

get mounted(): boolean

Whether the editor is mounted.

get nodes(): ToNodeAction<SimplifyDeeper<{[KeyType in string | number | symbol]: UnionToIntersection<ExtractTyping<E>["Nodes"] extends undefined ? never : ExtractTyping<E>["Nodes"]>[KeyType]}>>

All NodeActions defined by the editor.

get schema(): Schema<ExtractNodeNames<E>, ExtractMarkNames<E>>

The editor schema.

get state(): EditorState

The editor's current state.

get view(): EditorView

The editor view.

blur

ts
const blur: () => void

canExec

ts
const canExec: (command: Command) => boolean

dispatchEvent

ts
const dispatchEvent: (event: Event) => void

exec

ts
const exec: (command: Command) => boolean

focus

ts
const focus: () => void

mount

ts
const mount: (place: undefined | null | HTMLElement) => void

set

ts
const set: (doc: Node) => void

setContent

ts
const setContent: (content: string | Node | NodeJSON | HTMLElement, selection?: Selection | "start" | SelectionJSON | "end") => void

unmount

ts
const unmount: () => void

updateState

ts
const updateState: (state: EditorState) => void

use

ts
const use: (extension: Extension<ExtensionTyping<any, any, any>>) => VoidFunction

createTestEditor

ts
function createTestEditor<E extends Extension<ExtensionTyping<any, any, any>>>(options: EditorOptions<E>): TestEditor<E>