refactor: 🎨 Make editor.value var

This commit is contained in:
ThatOneCalculator 2022-04-03 22:28:38 -07:00
parent cbd21b6bb2
commit 3eb141ec72
1 changed files with 3 additions and 2 deletions

View File

@ -288,13 +288,14 @@ hideButton.addEventListener("click", function () {
})
markdownButton.addEventListener("click", function () {
let val = editor.value
if (isMarkdown) {
isMarkdown = false
editor.value = editor.value.substring(editor.value.indexOf("\n") + 1)
val = val.substring(val.indexOf("\n") + 1)
markdownButton.lastElementChild.classList.add("markdown")
} else {
isMarkdown = true
editor.value = `---\n${editor.value}`
val = `---\n${val}`
markdownButton.lastElementChild.classList.remove("markdown")
}
})