mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-16 11:13:23 +00:00
Merge branch 'markdown-editor' into 'master'
core: replace simplemde with easymde See merge request ae/Sith!202
This commit is contained in:
commit
8ebf5af3d6
7
core/static/core/easymde/easymde.min.css
vendored
Normal file
7
core/static/core/easymde/easymde.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
core/static/core/easymde/easymde.min.js
vendored
Normal file
7
core/static/core/easymde/easymde.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1232
core/static/core/font-awesome/js/fontawesome.min.js
vendored
Normal file
1232
core/static/core/font-awesome/js/fontawesome.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
core/static/core/simplemde/simplemde.min.css
vendored
7
core/static/core/simplemde/simplemde.min.css
vendored
File diff suppressed because one or more lines are too long
10362
core/static/core/simplemde/simplemde.min.js
vendored
10362
core/static/core/simplemde/simplemde.min.js
vendored
File diff suppressed because it is too large
Load Diff
@ -10,12 +10,8 @@
|
|||||||
<link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}">
|
<link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}">
|
||||||
<link rel="stylesheet" href="{{ scss('core/style.scss') }}">
|
<link rel="stylesheet" href="{{ scss('core/style.scss') }}">
|
||||||
<link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
|
<link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
|
||||||
{% if settings.EXTERNAL_RES %}
|
<link rel="stylesheet" href="/static/core/font-awesome/css/font-awesome.min.css">
|
||||||
<noscript><link rel="stylesheet" href="https://use.fontawesome.com/775817bb35.css"></noscript>
|
<script href="/core/static/core/font-awesome/js/fontawesone.min.js"></script>
|
||||||
<script src="https://use.fontawesome.com/c06c9c6980.js"></script>
|
|
||||||
{% else %}
|
|
||||||
<link rel="stylesheet" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!-- Jquery declared here to be accessible in every django widgets -->
|
<!-- Jquery declared here to be accessible in every django widgets -->
|
||||||
<script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
|
<script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<div>
|
<div>
|
||||||
{# Depends on this package https://github.com/sparksuite/simplemde-markdown-editor #}
|
{# Depends on this package https://github.com/lonaru/easy-markdown-editor #}
|
||||||
<textarea name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea>
|
<textarea name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea>
|
||||||
|
|
||||||
{# The simplemde script can be included twice, it's safe in the code #}
|
{# The easymde script can be included twice, it's safe in the code #}
|
||||||
<script src="{{ statics.js }}"> </script>
|
<script src="{{ statics.js }}"> </script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var css = "{{ statics.css }}";
|
var css = "{{ statics.css }}";
|
||||||
@ -25,9 +25,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pretty markdown input
|
// Pretty markdown input
|
||||||
var simplemde = new SimpleMDE({
|
var easymde = new EasyMDE({
|
||||||
element: document.getElementById("{{ widget.attrs.id }}"),
|
element: document.getElementById("{{ widget.attrs.id }}"),
|
||||||
spellChecker: false,
|
spellChecker: false,
|
||||||
|
autoDownloadFontAwesome: false,
|
||||||
previewRender: function(plainText, preview){ // Async method
|
previewRender: function(plainText, preview){ // Async method
|
||||||
clearTimeout(lastAPICall);
|
clearTimeout(lastAPICall);
|
||||||
lastAPICall = setTimeout(function (plainText, preview){
|
lastAPICall = setTimeout(function (plainText, preview){
|
||||||
@ -39,25 +40,25 @@
|
|||||||
toolbar: [
|
toolbar: [
|
||||||
{
|
{
|
||||||
name: "heading-smaller",
|
name: "heading-smaller",
|
||||||
action: SimpleMDE.toggleHeadingSmaller,
|
action: EasyMDE.toggleHeadingSmaller,
|
||||||
className: "fa fa-header",
|
className: "fa fa-header",
|
||||||
title: "{{ translations.heading_smaller }}"
|
title: "{{ translations.heading_smaller }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "italic",
|
name: "italic",
|
||||||
action: SimpleMDE.toggleItalic,
|
action: EasyMDE.toggleItalic,
|
||||||
className: "fa fa-italic",
|
className: "fa fa-italic",
|
||||||
title: "{{ translations.italic }}"
|
title: "{{ translations.italic }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bold",
|
name: "bold",
|
||||||
action: SimpleMDE.toggleBold,
|
action: EasyMDE.toggleBold,
|
||||||
className: "fa fa-bold",
|
className: "fa fa-bold",
|
||||||
title: "{{ translations.bold }}"
|
title: "{{ translations.bold }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "strikethrough",
|
name: "strikethrough",
|
||||||
action: SimpleMDE.toggleStrikethrough,
|
action: EasyMDE.toggleStrikethrough,
|
||||||
className: "fa fa-strikethrough",
|
className: "fa fa-strikethrough",
|
||||||
title: "{{ translations.strikethrough }}"
|
title: "{{ translations.strikethrough }}"
|
||||||
},
|
},
|
||||||
@ -90,71 +91,71 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "code",
|
name: "code",
|
||||||
action: SimpleMDE.toggleCodeBlock,
|
action: EasyMDE.toggleCodeBlock,
|
||||||
className: "fa fa-code",
|
className: "fa fa-code",
|
||||||
title: "{{ translations.code }}"
|
title: "{{ translations.code }}"
|
||||||
},
|
},
|
||||||
"|",
|
"|",
|
||||||
{
|
{
|
||||||
name: "quote",
|
name: "quote",
|
||||||
action: SimpleMDE.toggleBlockquote,
|
action: EasyMDE.toggleBlockquote,
|
||||||
className: "fa fa-quote-left",
|
className: "fa fa-quote-left",
|
||||||
title: "{{ translations.quote }}"
|
title: "{{ translations.quote }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unordered-list",
|
name: "unordered-list",
|
||||||
action: SimpleMDE.toggleUnorderedList,
|
action: EasyMDE.toggleUnorderedList,
|
||||||
className: "fa fa-list-ul",
|
className: "fa fa-list-ul",
|
||||||
title: "{{ translations.unordered_list }}"
|
title: "{{ translations.unordered_list }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ordered-list",
|
name: "ordered-list",
|
||||||
action: SimpleMDE.toggleOrderedList,
|
action: EasyMDE.toggleOrderedList,
|
||||||
className: "fa fa-list-ol",
|
className: "fa fa-list-ol",
|
||||||
title: "{{ translations.ordered_list }}"
|
title: "{{ translations.ordered_list }}"
|
||||||
},
|
},
|
||||||
"|",
|
"|",
|
||||||
{
|
{
|
||||||
name: "link",
|
name: "link",
|
||||||
action: SimpleMDE.drawLink,
|
action: EasyMDE.drawLink,
|
||||||
className: "fa fa-link",
|
className: "fa fa-link",
|
||||||
title: "{{ translations.link }}"
|
title: "{{ translations.link }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "image",
|
name: "image",
|
||||||
action: SimpleMDE.drawImage,
|
action: EasyMDE.drawImage,
|
||||||
className: "fa fa-picture-o",
|
className: "fa fa-picture-o",
|
||||||
title: "{{ translations.image }}"
|
title: "{{ translations.image }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "table",
|
name: "table",
|
||||||
action: SimpleMDE.drawTable,
|
action: EasyMDE.drawTable,
|
||||||
className: "fa fa-table",
|
className: "fa fa-table",
|
||||||
title: "{{ translations.table }}"
|
title: "{{ translations.table }}"
|
||||||
},
|
},
|
||||||
"|",
|
"|",
|
||||||
{
|
{
|
||||||
name: "clean-block",
|
name: "clean-block",
|
||||||
action: SimpleMDE.cleanBlock,
|
action: EasyMDE.cleanBlock,
|
||||||
className: "fa fa-eraser fa-clean-block",
|
className: "fa fa-eraser fa-clean-block",
|
||||||
title: "{{ translations.clean_block }}"
|
title: "{{ translations.clean_block }}"
|
||||||
},
|
},
|
||||||
"|",
|
"|",
|
||||||
{
|
{
|
||||||
name: "preview",
|
name: "preview",
|
||||||
action: SimpleMDE.togglePreview,
|
action: EasyMDE.togglePreview,
|
||||||
className: "fa fa-eye no-disable",
|
className: "fa fa-eye no-disable",
|
||||||
title: "{{ translations.preview }}"
|
title: "{{ translations.preview }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "side-by-side",
|
name: "side-by-side",
|
||||||
action: SimpleMDE.toggleSideBySide,
|
action: EasyMDE.toggleSideBySide,
|
||||||
className: "fa fa-columns no-disable no-mobile",
|
className: "fa fa-columns no-disable no-mobile",
|
||||||
title: "{{ translations.side_by_side }}"
|
title: "{{ translations.side_by_side }}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "fullscreen",
|
name: "fullscreen",
|
||||||
action: SimpleMDE.toggleFullScreen,
|
action: EasyMDE.toggleFullScreen,
|
||||||
className: "fa fa-arrows-alt no-disable no-mobile",
|
className: "fa fa-arrows-alt no-disable no-mobile",
|
||||||
title: "{{ translations.fullscreen }}"
|
title: "{{ translations.fullscreen }}"
|
||||||
},
|
},
|
||||||
|
@ -98,8 +98,8 @@ class MarkdownInput(Textarea):
|
|||||||
context = super(MarkdownInput, self).get_context(name, value, attrs)
|
context = super(MarkdownInput, self).get_context(name, value, attrs)
|
||||||
|
|
||||||
context["statics"] = {
|
context["statics"] = {
|
||||||
"js": static("core/simplemde/simplemde.min.js"),
|
"js": static("core/easymde/easymde.min.js"),
|
||||||
"css": static("core/simplemde/simplemde.min.css"),
|
"css": static("core/easymde/easymde.min.css"),
|
||||||
}
|
}
|
||||||
context["translations"] = {
|
context["translations"] = {
|
||||||
"heading_smaller": _("Heading"),
|
"heading_smaller": _("Heading"),
|
||||||
|
Loading…
Reference in New Issue
Block a user