prosekit/preact
ProseKitProps
Properties
children?
optional
children:ComponentChildren
editor
editor:
Editor
<any
>
UseExtensionOptions
Properties
editor?
optional
editor: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.
ProseKit
const
ProseKit:ComponentType
<ProseKitProps
>
The root component for a ProseKit editor.
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
false
Returns
Editor
<E
>
useExtension()
useExtension(
extension
,options
?):void
Add an extension to the editor.
Parameters
• extension: null
| Extension
<ExtensionTyping
<any
, any
, any
>>
The 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: 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