Skip to content

Commit

Permalink
Add createState export
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Mar 20, 2024
1 parent 6293b96 commit 0f45126
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import extensions from "./extensions"

export { extensions }

export function createState (state: EditorStateConfig = {}) {
return EditorState.create({
extensions,
...state,
})
}

export function createEditor (element: HTMLElement, state: EditorStateConfig = {}) {
return new EditorView({
parent: element,
state: EditorState.create({
extensions,
...state,
}),
state: createState(state),
})
}

0 comments on commit 0f45126

Please sign in to comment.