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 ++++ .../templates/wiki/plugins/links/sidebar.html | 74 ++++++++++++++-------- 2 files changed, 60 insertions(+), 25 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; } })(); diff --git a/pydis_site/templates/wiki/plugins/links/sidebar.html b/pydis_site/templates/wiki/plugins/links/sidebar.html index 45096edd..80c390dc 100644 --- a/pydis_site/templates/wiki/plugins/links/sidebar.html +++ b/pydis_site/templates/wiki/plugins/links/sidebar.html @@ -1,44 +1,68 @@ -{% load i18n sekizai_tags static %} +{% load sekizai_tags static %} -

{% trans "Link to another wiki page" %}

+

Link to another wiki page

- {% trans "Type in something from another wiki page's title and auto-complete will help you create a tag for your wiki link. Tags for links look like this:" %}
+ Type in something from another wiki page's title and auto-complete will help you create a tag for your wiki link. Tags for links look like this:

[Title of link](wiki:ArticleSlug)
-
- - - - +
+
+ + + + + +
-
+
-

{% trans "An external link" %}

+

An external link

- {% trans "You can link to another website simply by inserting an address example.com or http://example.com or by using the markdown syntax:" %}
+ You can link to another website simply by inserting an address example.com or http://example.com or by using the markdown syntax:

+
[Clickable text](http://example.com)
-{% addtoblock "js" %}{% endaddtoblock %} {% addtoblock "js" %} - + + {% endaddtoblock %} -- cgit v1.2.3