From 4167374b71ef00da4203151f380eb561ac340d59 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 18 Apr 2019 16:24:15 +0100 Subject: Links plugin is.. functional.. --- pydis_site/static/js/wiki/load_editor.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pydis_site/static/js/wiki') 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; } })(); -- cgit v1.2.3