Skip to content
GitHub

prosekit/solid

Options for defineSolidMarkView.

as?: MarkViewDOMSpec

component: SolidMarkViewComponent

contentAs?: MarkViewDOMSpec

destroy?: () => void

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

name: string

The name of the mark type.


  • MarkViewContextProps

contentRef: MarkViewContentRef

mark: Mark

view: EditorView


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: ProseMirrorNode, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean | void


  • NodeViewContextProps

contentRef: NodeViewContentRef

decorations: readonly Decoration[]

getPos: () => undefined | number

innerDecorations: DecorationSource

node: ProseMirrorNode

selected: boolean

setAttrs: (attrs: Attrs) => void

view: EditorView


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 MaybeAccessor<T> = T | Accessor<T>

T or a reactive/non-reactive function returning T

Type Parameter

T


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


type SolidMarkViewComponent = Component<SolidMarkViewProps>


type SolidNodeViewComponent = Component<SolidNodeViewProps>

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.