mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-19 15:33:45 +02:00
13 lines
478 B
TypeScript
13 lines
478 B
TypeScript
import {basicSetup, EditorView} from "codemirror"
|
|
import {markdown} from "@codemirror/lang-markdown"
|
|
|
|
const textarea = document.getElementById("id_description_md")! as HTMLTextAreaElement
|
|
let editor = new EditorView({
|
|
doc: textarea.value,
|
|
extensions: [basicSetup, markdown()],
|
|
})
|
|
textarea.parentNode!.insertBefore(editor.dom, textarea)
|
|
textarea.style.display = "none"
|
|
textarea.form?.addEventListener("submit", () => {
|
|
textarea.value = editor.state.doc.toString()
|
|
})
|