Skip to content

prosekit/solid

UseExtensionOptions

Properties

editor?

optional editor: MaybeAccessor<Editor<any>>

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

priority?

optional priority: Priority

Optional priority to add the extension with.


MaybeAccessor<T>

MaybeAccessor<T>: T | Accessor<T>

T or a reactive/non-reactive function returning T

Type Parameters

T


ProseKitProps

ProseKitProps: ParentProps<object>

Type declaration

NameType
editorEditor

ProseKit()

ProseKit(props): Element

The root component for a ProseKit editor.

Parameters

props: ProseKitProps

Returns

Element


useDocChange()

useDocChange(handler, options?): void

Calls the given handler whenever the editor document changes.

Parameters

handler

options?: UseExtensionOptions

Returns

void


useEditor()

useEditor<E>(options?): () => Editor<E>

Retrieves the editor instance from the nearest ProseKit component.

Type Parameters

E extends Extension<ExtensionTyping<any, any, any>> = any

Parameters

options?

options.update?: boolean

Whether to update the component when the editor is mounted or editor state is updated.

Default

ts
false

Returns

Function

Returns

Editor<E>


useExtension()

useExtension(extension, options?): void

Add an extension to the editor.

Parameters

extension: Accessor<null | Extension<ExtensionTyping<any, any, any>>>

The accessor to an extension to add to the editor. If it changes, the previous extension will be removed and the new one (if not null) will be added.

options?: UseExtensionOptions

Returns

void


useKeymap()

useKeymap(keymap, options?): void

Parameters

keymap

options?: UseExtensionOptions

Returns

void


useStateUpdate()

useStateUpdate(handler, options?): void

Calls the given handler whenever the editor state changes.

Parameters

handler

options?: UseExtensionOptions

Returns

void