diff options
author | 2019-04-15 10:18:11 +0100 | |
---|---|---|
committer | 2019-04-15 10:18:11 +0100 | |
commit | 596a9acf4e47449fc7990cbbc842742415d141a0 (patch) | |
tree | 097843ae0bd7c281957409485500445f1d4fd372 /pydis_site/static | |
parent | Breadcrumb/article menu work (diff) |
Editor: TOC insert correctly places on previous line rather than next line
Diffstat (limited to 'pydis_site/static')
-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) } } |