prosekit/svelte
Interfaces
Section titled “Interfaces”ProseKitProps
Section titled “ProseKitProps”Properties
Section titled “Properties”SvelteMarkViewOptions
Section titled “SvelteMarkViewOptions”Options for defineSvelteMarkView.
Extends
Section titled “Extends”CoreMarkViewUserOptions
<SvelteMarkViewComponent
>
Properties
Section titled “Properties”-
as?:
MarkViewDOMSpec
-
contentAs?:
MarkViewDOMSpec
-
destroy?: () =>
void
-
ignoreMutation?: (
mutation
:ViewMutationRecord
) =>boolean
|void
-
name:
string
-
The name of the mark type.
SvelteMarkViewProps
Section titled “SvelteMarkViewProps”Extends
Section titled “Extends”MarkViewContext
Properties
Section titled “Properties”-
contentRef: (
element
:null
|HTMLElement
) =>void
SvelteNodeViewOptions
Section titled “SvelteNodeViewOptions”Options for defineSvelteNodeView.
Extends
Section titled “Extends”CoreNodeViewUserOptions
<SvelteNodeViewComponent
>
Properties
Section titled “Properties”-
as?:
NodeViewDOMSpec
-
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
-
update?: (
node
:ProseMirrorNode
,decorations
: readonlyDecoration
[],innerDecorations
:DecorationSource
) =>boolean
|void
SvelteNodeViewProps
Section titled “SvelteNodeViewProps”Extends
Section titled “Extends”NodeViewContext
Properties
Section titled “Properties”-
contentRef: (
element
:null
|HTMLElement
) =>void
-
decorations:
Writable
<readonlyDecoration
[]>
-
getPos: () =>
undefined
|number
-
innerDecorations:
Writable
<DecorationSource
>
-
node:
Writable
<ProseMirrorNode
>
-
selected:
Writable
<boolean
>
UseExtensionOptions
Section titled “UseExtensionOptions”Properties
Section titled “Properties”-
The editor to add the extension to. If not provided, it will use the editor from the nearest
ProseKit
component.
Type Aliases
Section titled “Type Aliases”SvelteMarkViewComponent
Section titled “SvelteMarkViewComponent”-
type SvelteMarkViewComponent =
Component
<SvelteMarkViewProps
>
SvelteNodeViewComponent
Section titled “SvelteNodeViewComponent”-
type SvelteNodeViewComponent =
Component
<SvelteNodeViewProps
>
Variables
Section titled “Variables”ProseKit
Section titled “ProseKit”-
const ProseKit: typeof
SvelteComponent
-
The root component for a ProseKit editor.
Functions
Section titled “Functions”defineSvelteMarkView()
Section titled “defineSvelteMarkView()”-
function defineSvelteMarkView(
options
:SvelteMarkViewOptions
):Extension
-
Defines a mark view using a Svelte component.
defineSvelteNodeView()
Section titled “defineSvelteNodeView()”-
function defineSvelteNodeView(
options
:SvelteNodeViewOptions
):Extension
-
Defines a node view using a Svelte component.
useDocChange()
Section titled “useDocChange()”-
function useDocChange(
handler
: (doc
:ProseMirrorNode
) =>void
,options?
:UseExtensionOptions
):void
-
Calls the given handler whenever the editor document changes.
useEditor()
Section titled “useEditor()”-
function useEditor<E>(
options?
:object
):Readable
<Editor
<E
>> -
Retrieves the editor instance from the nearest ProseKit component.
useExtension()
Section titled “useExtension()”-
function useExtension<T>(
extension
:Readable
<null
|T
>,options?
:UseExtensionOptions
):void
-
Add an extension to the editor.
useKeymap()
Section titled “useKeymap()”-
function useKeymap(
keymapStore
:Readable
<Keymap
>,options?
:UseExtensionOptions
):void
useStateUpdate()
Section titled “useStateUpdate()”-
function useStateUpdate(
handler
: (state
:EditorState
) =>void
,options?
:UseExtensionOptions
):void
-
Calls the given handler whenever the editor state changes.