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). # This interactive demo will give you an overview of the features. {title: Song Title} {artist: Artist Name} {start_of_verse} This is a [C]song with chords {end_of_verse} {start_of_chorus} This is the [G]chorus {end_of_chorus} # Features: # โœ… Syntax Highlighting # โœ… Chord autocomplete - type "[" and you will see autocomplete of previously used chords # โœ… Snippets - type "title", "start_ofโ€ฆ", "tab" or any other ChordPro directive ` const el = document.querySelector('#editor')! createEditor({ parent: el, doc, extensions: [ linter((view) => { return [{ from: 0, to: 46, message: "This is what warnings look like", severity: "warning" }] }) ] }) el.addEventListener('focus', console.log) el.addEventListener('blur', console.log) el.addEventListener('change', console.log) el.addEventListener('paste', console.log)