Skip to content

Commit

Permalink
Add script.coffee (v0.1.0-preview2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Magayaga committed May 26, 2024
1 parent f196554 commit ebe6f6d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/assets/scripts/script.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
editor = CodeMirror.fromTextArea(document.getElementById("editor"),
lineNumbers: true
value: ""
mode: "markdown"
theme: "default"
extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
foldGutter: true
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
styleActiveLine: true
autoCloseTags: true
lineWrapping: true
hintOptions: { hint: CodeMirror.hint.anyword }
matchBrackets: true
extraKeys: {"Ctrl-Space": "autocomplete"}
)

editor.on "change", ->
updateFooterInfo()

updateFooterInfo = ->
cursor = editor.getCursor()
lineNum = cursor.line + 1
colNum = cursor.ch + 1
document.getElementById("line-number").textContent = lineNum
document.getElementById("column-number").textContent = colNum

updateFooterInfo()

0 comments on commit ebe6f6d

Please sign in to comment.