Skip to content

Commit 6717f33

Browse files
committed
merge many pull requests
1 parent 48c7262 commit 6717f33

File tree

11 files changed

+34
-46
lines changed

11 files changed

+34
-46
lines changed

martor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
__VERSION__ = '1.4.4'
3+
__VERSION__ = '1.4.5'
44
__AUTHOR__ = 'Agus Makmun (Summon Agus)'
55
__AUTHOR_EMAIL__ = '[email protected]'
-41 Bytes
Binary file not shown.

martor/locale/en/LC_MESSAGES/django.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-30 05:47+0700\n"
11+
"POT-Creation-Date: 2020-01-21 10:54+0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
-39 Bytes
Binary file not shown.

martor/locale/id/LC_MESSAGES/django.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-30 05:48+0700\n"
11+
"POT-Creation-Date: 2020-01-21 10:54+0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"

martor/settings.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
# Input: string boolean, `true/false`
55
MARTOR_ENABLE_CONFIGS = getattr(
66
settings, 'MARTOR_ENABLE_CONFIGS', {
7-
'imgur': 'true', # to enable/disable imgur/custom uploader.
8-
'mention': 'false', # to enable/disable mention
9-
'jquery': 'true', # to include/revoke jquery (require for admin default django)
10-
'living': 'false', # to enable/disable live updates in preview
7+
'emoji': 'true', # to enable/disable emoji icons.
8+
'imgur': 'true', # to enable/disable imgur/custom uploader.
9+
'mention': 'false', # to enable/disable mention
10+
'jquery': 'true', # to include/revoke jquery (require for admin default django)
11+
'living': 'false', # to enable/disable live updates in preview
1112
'spellcheck': 'true', # to enable/disable spellcheck in form textareas
12-
'hljs': 'true', # to enable/disable hljs highlighting in preview
13+
'hljs': 'true', # to enable/disable hljs highlighting in preview
1314
}
1415
)
1516

martor/static/martor/css/martor.min.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/js/martor.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* Name : Martor v1.4.1
2+
* Name : Martor v1.4.5
33
* Created by : Agus Makmun (Summon Agus)
4-
* Release date : 30-Jun-2019
4+
* Release date : 21-Jan-2020
55
* License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
66
* Repository : https://github.com/agusmakmun/django-markdown-editor
77
**/
@@ -142,12 +142,7 @@
142142
// update the preview if this menu is clicked
143143
var currentTab = $('.tab.segment[data-tab=preview-tab-'+field_name+']');
144144
var previewTabButton = $('.item[data-tab=preview-tab-'+field_name+']');
145-
var needsRefresh = true;
146145
var refreshPreview = function() {
147-
if (!needsRefresh) {
148-
return;
149-
}
150-
151146
var value = textareaId.val();
152147
var form = new FormData();
153148
form.append('content', value);
@@ -162,13 +157,13 @@
162157
contentType: false,
163158
success: function(response) {
164159
if (response) {
165-
currentTab.html(response).removeClass('martor-preview-stale');
166160
if (editorConfig.hljs == 'true') {
167161
$('pre').each(function (i, block) {
168162
hljs.highlightBlock(block);
169163
});
170164
}
171-
needsRefresh = false;
165+
currentTab.html(response).removeClass('martor-preview-stale');
166+
$(document).trigger('martor:preview', [currentTab]);
172167
} else {
173168
currentTab.html('<p>Nothing to preview</p>');
174169
}
@@ -182,24 +177,14 @@
182177
// Refresh the preview unconditionally on first load.
183178
refreshPreview();
184179

185-
// Set if editor has changed.
186-
editor.on('change', function (evt) {
187-
var value = editor.getValue();
188-
if (value !== textareaId.val()) {
189-
textareaId.val(value);
190-
needsRefresh = true;
191-
if (editorConfig.living === 'true') {
192-
refreshPreview();
193-
}
194-
}
195-
});
196-
197180
if (editorConfig.living !== 'true') {
198181
previewTabButton.click(function(){
199182
// hide the `.martor-toolbar` for this current editor if under preview.
200183
$(this).closest('.tab-martor-menu').find('.martor-toolbar').hide();
201184
refreshPreview();
202185
});
186+
}else {
187+
editor.on('change', refreshPreview);
203188
}
204189

205190
var editorTabButton = $('.item[data-tab=editor-tab-'+field_name+']');
@@ -209,7 +194,11 @@
209194
});
210195

211196
if (editorConfig.spellcheck == 'true') {
212-
enable_spellcheck(editorId);
197+
try {
198+
enable_spellcheck(editorId);
199+
}catch (e) {
200+
console.log("Spellcheck lib doesn't installed.");
201+
}
213202
}
214203

215204
// win/linux: Ctrl+B, mac: Command+B

martor/static/martor/js/martor.min.js

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/templates/martor/guide.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<td><img class="marked-emoji" src="{% static 'plugins/images/heart.png' %}"></td>
2525
</tr>
2626
{% endif %}
27+
2728
{% if mentions_enabled %}
2829
<tr>
2930
<td>@[username]</td>
@@ -33,9 +34,11 @@
3334
<td><a href="#">@username</a></td>
3435
</tr>
3536
{% endif %}
37+
3638
{% if emoji_enabled or mentions_enabled %}
3739
<tr><td colspan="5"></td></tr>
3840
{% endif %}
41+
3942
<tr>
4043
<td>*Italic*</td>
4144
<td>_Italic_</td>

0 commit comments

Comments
 (0)