Skip to content

prosekit/preact

ProseKitProps

children

Type: ComponentChildren

editor

Type: Editor<any>

UseExtensionOptions

editor

The editor to add the extension to. If not provided, it will use the editor from the nearest ProseKit component.

Type: Editor<any>

priority

Optional priority to add the extension with.

Type: Priority

ProseKit

The root component for a ProseKit editor.

Type: ComponentType<ProseKitProps>

useDocChange

ts
function useDocChange(handler: (doc: Node) => void, options?: UseExtensionOptions): void

Calls the given handler whenever the editor document changes.

useEditor

ts
function useEditor<E extends Extension<ExtensionTyping<any, any, any>>>(options?: { update?: boolean }): Editor<E>

Retrieves the editor instance from the nearest ProseKit component.

useExtension

ts
function useExtension(extension: null | Extension<ExtensionTyping<any, any, any>>, options?: UseExtensionOptions): void

Add an extension to the editor.

useKeymap

ts
function useKeymap(keymap: Keymap, options?: UseExtensionOptions): void

useStateUpdate

ts
function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void

Calls the given handler whenever the editor state changes.