Update templates
This commit is contained in:
37
myapp/templates/inc/editor.js
Normal file
37
myapp/templates/inc/editor.js
Normal file
@@ -0,0 +1,37 @@
|
||||
{% macro plugin(type="tinymce") -%}
|
||||
{% if type=="tinymce" %}
|
||||
<script type="text/javascript" src="/static/tinymce/tinymce.min.js"></script>
|
||||
{% elif type=="ckeditor" %}
|
||||
<script type="text/javascript" src="/static/ckeditor/ckeditor.js"></script>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro ckeditor(name) -%}
|
||||
CKEDITOR.replace( '{{ name }}', {
|
||||
customConfig: '/static/js/ckeditor-conf.js'
|
||||
} );
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro tinymce(name) -%}
|
||||
tinymce.init({
|
||||
selector: 'textarea#{{ name }}',
|
||||
height: 400,
|
||||
language: 'ru',
|
||||
plugins: "code link image table",
|
||||
toolbar: "table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"
|
||||
});
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro getValue(name, param, type="tinymce") -%}
|
||||
{% if type=="tinymce" %}
|
||||
let value = tinymce.get("{{ name }}").getContent();
|
||||
if (value != {{ param }}) {
|
||||
{{ param }} = value;
|
||||
}
|
||||
{% elif type=="ckeditor" %}
|
||||
var value = CKEDITOR.instances["{{ name }}"].getData();
|
||||
if (value != {{ param }}) {
|
||||
{{ param }} = value;
|
||||
}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user