Skip to content
GitHubDiscord

prosekit/solid

contentRef: MarkViewContentRef

view: EditorView

mark: Mark


Options for defineSolidMarkView.

name: string

The name of the mark type.

as?: MarkViewDOMSpec

contentAs?: MarkViewDOMSpec

component: SolidMarkViewComponent

ignoreMutation?: (mutation: ViewMutationRecord) => boolean | void

destroy?: () => void


contentRef: NodeViewContentRef

view: EditorView

getPos: () => undefined | number

setAttrs: (attrs: Attrs) => void

node: ProseMirrorNode

selected: boolean

decorations: readonly Decoration[]

innerDecorations: DecorationSource


Options for defineSolidNodeView.

name: string

The name of the node type.

as?: NodeViewDOMSpec

contentAs?: NodeViewDOMSpec

component: SolidNodeViewComponent

update?: (node: ProseMirrorNode, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean | void

ignoreMutation?: (mutation: ViewMutationRecord) => boolean | void

selectNode?: () => void

deselectNode?: () => void

setSelection?: (anchor: number, head: number, root: Document | ShadowRoot) => void

stopEvent?: (event: Event) => boolean

destroy?: () => void

onUpdate?: () => void


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?: Priority

Optional priority to add the extension with.

type ProseKitProps = ParentProps<{ editor: Editor; }>


type SolidMarkViewComponent = Component<SolidMarkViewProps>


type SolidNodeViewComponent = Component<SolidNodeViewProps>


type MaybeAccessor<T> = T | Accessor<T>

T or a reactive/non-reactive function returning T

const ProseKit: Component<ProseKitProps>

The root component for a ProseKit editor.

function defineSolidMarkView(options: SolidMarkViewOptions): Extension

Defines a mark view using a Solid component.


function defineSolidNodeView(options: SolidNodeViewOptions): Extension

Defines a node view using a Solid component.


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

Calls the given handler whenever the editor document changes.


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

Retrieves the editor instance from the nearest ProseKit component.


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

Add an extension to the editor.


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


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

Calls the given handler whenever the editor state changes.