Skip to content

Commit

Permalink
Also accept other extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Mar 22, 2024
1 parent 0631867 commit a4928cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions demo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createEditor } from "./src/"
import { linter } from "@codemirror/lint"

const doc = `# Welcome to the new ChordBook.app Editor! 🎸
# This editor is optimized for the ChordPro format (https://www.chordpro.org).
Expand Down Expand Up @@ -27,6 +28,11 @@ createEditor({
parent: el,
state: {
doc,
extensions: [
linter((view) => {
return [{ from: 0, to: 46, message: "This is what warnings look like", severity: "warning" }]
})
],
events: {
changeInterval: 500, // `change` events are debounced by default (300ms)
}
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function createState({ events, ...state }: StateConfig = {}) {
...state,
extensions: [
...extensions,
...eventsToExtensions(events)
...eventsToExtensions(events),
state.extensions ?? []
],
})
}
Expand Down

0 comments on commit a4928cd

Please sign in to comment.