diff options
author | 2019-04-18 16:24:15 +0100 | |
---|---|---|
committer | 2019-04-18 16:24:15 +0100 | |
commit | 4167374b71ef00da4203151f380eb561ac340d59 (patch) | |
tree | 71ed7907563eda7b5a1e84e670ea4cd32b8a5b6b /pydis_site/static | |
parent | Images plugin is complete. (diff) |
Links plugin is.. functional..
Diffstat (limited to 'pydis_site/static')
-rw-r--r-- | pydis_site/static/js/wiki/load_editor.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pydis_site/static/js/wiki/load_editor.js b/pydis_site/static/js/wiki/load_editor.js index 0671daed..589d8a75 100644 --- a/pydis_site/static/js/wiki/load_editor.js +++ b/pydis_site/static/js/wiki/load_editor.js @@ -43,6 +43,15 @@ } } + function add_insert_text(editor) { + editor.insert_text = function(text) { + let doc = editor.codemirror.getDoc(), + cursor = doc.getCursor(); + + doc.replaceRange(text, cursor); + } + } + for (let element of elements) { let editor = new SimpleMDE({ "element": element, @@ -80,6 +89,8 @@ }); add_insert_image_wiki(editor); + add_insert_text(editor); + window.editors[element.id] = editor; } })(); |