prosekit/core/test
Interfaces
Section titled “Interfaces”TestEditor<E>
Section titled “TestEditor<E>”Accessors
Section titled “Accessors”-
get mounted():
boolean
-
Whether the editor is mounted.
Inherited from
Section titled “Inherited from”-
get view():
EditorView
-
The editor view.
Inherited from
Section titled “Inherited from”Inherited from
Section titled “Inherited from”-
get state():
EditorState
-
The editor's current state.
Inherited from
Section titled “Inherited from”-
get focused():
boolean
-
Whether the editor is focused.
Inherited from
Section titled “Inherited from”-
get commands():
ExtractCommandActions
<E
> -
All CommandActions defined by the editor.
Inherited from
Section titled “Inherited from”-
get nodes():
ExtractNodeActions
<E
> -
All NodeActions defined by the editor.
Inherited from
Section titled “Inherited from”-
get marks():
ExtractMarkActions
<E
> -
All MarkActions defined by the editor.
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”-
mount(
place
:undefined
|null
|HTMLElement
):void
-
Mount the editor to the given HTML element. Pass
null
orundefined
to unmount the editor.Inherited from
Section titled “Inherited from”
-
unmount():
void
-
Unmount the editor. This is equivalent to
mount(null)
.Inherited from
Section titled “Inherited from”
-
focus():
void
-
Focus the editor.
Inherited from
Section titled “Inherited from”
-
blur():
void
-
Blur the editor.
Inherited from
Section titled “Inherited from”
-
Register an extension to the editor. Return a function to unregister the extension.
Inherited from
Section titled “Inherited from”
-
updateState(
state
:EditorState
):void
-
Update the editor's state.
Remarks
Section titled “Remarks”This is an advanced method. Use it only if you have a specific reason to directly manipulate the editor's state.
Inherited from
Section titled “Inherited from”
-
setContent(
content
:string
|ProseMirrorNode
|NodeJSON
|HTMLElement
,selection?
:Selection
|"start"
|SelectionJSON
|"end"
):void
-
Update the editor's document and selection.
Inherited from
Section titled “Inherited from”
-
Return a JSON object representing the editor's current document.
Inherited from
Section titled “Inherited from”
-
getDocHTML(
options?
:getDocHTMLOptions
):string
-
Return a HTML string representing the editor's current document.
Inherited from
Section titled “Inherited from”
-
Execute the given command. Return
true
if the command was successfully executed, otherwisefalse
.Inherited from
Section titled “Inherited from”
-
Check if the given command can be executed. Return
true
if the command can be executed, otherwisefalse
.Inherited from
Section titled “Inherited from”
-
set(
doc
:ProseMirrorNode
):void
-
Set the editor state to the given document. You can use special tokens
<a>
and<b>
to set the anchor and head positions of the selection.Example
Section titled “Example”const editor = createTestEditor({ extension }) const n = editor.nodes const doc = n.doc(n.paragraph('<a>Hello<b> world!')) editor.set(doc) // "Hello" is selected.
-
dispatchEvent(
event
:Event
):void
Functions
Section titled “Functions”createTestEditor()
Section titled “createTestEditor()”-
function createTestEditor<E>(
options
:EditorOptions
<E
>):TestEditor
<E
>