diff --git a/themes/grav/js/mdeditor.js b/themes/grav/js/mdeditor.js
index d023d1d7..db4c1d5c 100644
--- a/themes/grav/js/mdeditor.js
+++ b/themes/grav/js/mdeditor.js
@@ -66,30 +66,14 @@
};
};
- var template = [
- '
',
- '
',
- '
',
- '
',
- '
Preview
',
- '
',
- '
',
- '
'
- ].join('');
+ var template = '';
var MDEditor = function(editor, options){
- var tpl = '' + template, $this = this,
+ var $this = this,
task = 'task' + GravAdmin.config.param_sep;
+ var tpl = ''
+
this.defaults = {
markdown : false,
autocomplete : true,
@@ -107,6 +91,34 @@
this.CodeMirror = CodeMirror;
this.buttons = {};
+ template = [
+ '',
+ '
',
+ '
',
+ '
',
+ '
'];
+
+ if (!$this.element.data('grav-preview-disabled')) {
+ template.push('- {:lblCodeview}
');
+ template.push('- {:lblPreview}
');
+ }
+
+ template.push(
+ ' ',
+ '
',
+ '
',
+ '
Preview
',
+ '
',
+ '
',
+ '
'
+ );
+
+ template = template.join('');
+
+ tpl += template;
tpl = tpl.replace(/\{:lblPreview\}/g, this.options.lblPreview);
tpl = tpl.replace(/\{:lblCodeview\}/g, this.options.lblCodeview);
diff --git a/themes/grav/templates/forms/fields/markdown/markdown.html.twig b/themes/grav/templates/forms/fields/markdown/markdown.html.twig
index a0bf5bf8..4d530eb7 100644
--- a/themes/grav/templates/forms/fields/markdown/markdown.html.twig
+++ b/themes/grav/templates/forms/fields/markdown/markdown.html.twig
@@ -9,7 +9,7 @@
{% block field %}
{% endblock %}
\ No newline at end of file