Skip to content

prosekit/solid

SolidMarkViewOptions

Options for defineSolidMarkView.

as?: MarkViewDOMSpec

component: SolidMarkViewComponent

contentAs?: MarkViewDOMSpec

destroy?: () => void

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

name: string

The name of the mark type.

SolidMarkViewProps

contentRef: MarkViewContentRef

mark: Mark

view: EditorView

SolidNodeViewOptions

Options for defineSolidNodeView.

as?: NodeViewDOMSpec

component: SolidNodeViewComponent

contentAs?: NodeViewDOMSpec

deselectNode?: () => void

destroy?: () => void

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

name: string

The name of the node type.

onUpdate?: () => void

selectNode?: () => void

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

stopEvent?: (event: Event) => boolean

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

SolidNodeViewProps

contentRef: NodeViewContentRef

decorations: readonly Decoration[]

getPos: () => undefined | number

innerDecorations: DecorationSource

node: Node

selected: boolean

setAttrs: (attrs: Attrs) => void

view: EditorView

UseExtensionOptions

editor?: MaybeAccessor<Editor>

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.

MaybeAccessor

T or a reactive/non-reactive function returning T

Type: T | Accessor<T>

ProseKitProps

Type: ParentProps<{ editor: Editor }>

SolidMarkViewComponent

Type: Component<SolidMarkViewProps>

SolidNodeViewComponent

Type: Component<SolidNodeViewProps>

defineSolidMarkView

ts
function defineSolidMarkView(options: SolidMarkViewOptions): Extension

Defines a mark view using a Solid component.

defineSolidNodeView

ts
function defineSolidNodeView(options: SolidNodeViewOptions): Extension

Defines a node view using a Solid component.

ProseKit

The root component for a ProseKit editor.

ts
function ProseKit(props: ProseKitProps): Element

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>(options?: { update?: boolean }): () => Editor<E>

Retrieves the editor instance from the nearest ProseKit component.

useExtension

ts
function useExtension(extension: Accessor<null | Extension>, 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.