prosekit/core/test
TestEditor
Extends Editor<E>
An editor for testing purposes.
constructor
new TestEditor<E extends Extension>(instance: EditorInstance): TestEditor<E>
dispatchEvent
- ts
const dispatchEvent: (event: Event) => void
set
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
tsconst editor = createTestEditor({ extension }) const n = editor.nodes const doc = n.doc(n.paragraph('<a>Hello<b> world!')) editor.set(doc) // "Hello" is selected.
tsconst set: (doc: ProseMirrorNode) => void
createTestEditor
ts
function createTestEditor<E extends Extension>(options: EditorOptions<E>): TestEditor<E>