Add enable_tinymce option to Pages editor

This commit is contained in:
slawkens
2020-02-11 01:02:46 +01:00
parent 1ab32ca3ba
commit f475c671f7
5 changed files with 58 additions and 13 deletions

View File

@@ -33,12 +33,25 @@
<div class="col-sm-10">
<input type="checkbox" id="php" name="php"
title="Check if page should be executed as PHP"
value="1"{% if php %} checked="true"{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
value="1"{% if php %} checked{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="php" value="{% if php %}1{% else %}0{% endif %}"/>
{% endif %}
</div>
</div>
{% if not php %}
<div class="form-group">
<label for="enable_tinymce" class="col-sm-2 control-label">Enable TinyMCE</label>
<div class="col-sm-10">
<input type="checkbox" id="enable_tinymce" name="enable_tinymce"
title="Check if you want to use TinyMCE Editor"
value="1"{% if enable_tinymce %} checked{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="enable_tinymce" value="{% if enable_tinymce %}1{% else %}0{% endif %}"/>
{% endif %}
</div>
</div>
{% endif %}
<div class="form-group">
<label for="body" class="col-sm-2 control-label">Content</label>
<div class="col-sm-10" id="body-parent">
@@ -72,8 +85,8 @@
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
$(function () {
$('#php').on('change', function (e) {
if (this.checked) {
$('#enable_tinymce').on('change', function (e) {
if (!this.checked) {
tinymce.remove('#body');
} else {
if (tinymce.editors.length > 0) {
@@ -85,7 +98,7 @@
}
});
{% if not php %}
{% if not php and enable_tinymce %}
init_tinymce();
{% endif %}
@@ -108,4 +121,4 @@
return txt.value;
}
});
</script> {% endif %}
</script> {% endif %}