diff options
-rw-r--r-- | pydis_site/static/js/wiki/load_editor.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pydis_site/static/js/wiki/load_editor.js b/pydis_site/static/js/wiki/load_editor.js index 1837c7fd..69730b14 100644 --- a/pydis_site/static/js/wiki/load_editor.js +++ b/pydis_site/static/js/wiki/load_editor.js @@ -19,23 +19,23 @@ const TOCAction = { name: "toc", - action: inserTOC, + action: insertTOC, className: "fa fa-stream", title: "Insert Table of Contents" }; let elements = document.getElementsByClassName("simple-mde"); - function inserTOC(editor) { + function insertTOC(editor) { let doc = editor.codemirror.getDoc(), cursor = doc.getCursor(), line = doc.getLine(cursor.line), - position = {"line": cursor.line}; + position = {"line": cursor.line, "ch": 0}; if (line.length === 0) { doc.replaceRange(TOCText, position); } else { - doc.replaceRange("\n" + TOCText, position) + doc.replaceRange(TOCText + "\n", position) } } |