41 lines
1.9 KiB
HTML
41 lines
1.9 KiB
HTML
|
<script src="/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||
|
<script>
|
||
|
function tinymce_init(element, id) {
|
||
|
tinymce.remove(element);
|
||
|
tinymce.init({
|
||
|
selector: element + '#' + id,
|
||
|
|
||
|
auto_focus: id,
|
||
|
highlight_on_focus: true,
|
||
|
|
||
|
skin: '{{ skin | default:'oxide' }}',
|
||
|
content_css: '{{ css | default:'dark' }}',
|
||
|
min_height: {{ min_height | default:500 }},
|
||
|
|
||
|
plugins: 'accordion lists advlist anchor autolink autoresize autosave ' +
|
||
|
'charmap code codesample directionality emoticons fullscreen ' +
|
||
|
'help image insertdatetime link media nonbreaking ' +
|
||
|
'pagebreak preview quickbars save searchreplace table template ' +
|
||
|
'visualblocks visualchars wordcount',
|
||
|
toolbar1: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify alignnone | styles | emoticons',
|
||
|
toolbar2: 'cut copy paste pastetext | bullist numlist | outdent indent | redo undo blockquote | link unlink openlink anchor image',
|
||
|
toolbar3: 'table | hr removeformat visualblocks | subscript superscript | charmap media insertdatetime | visualchars nonbreaking pagebreak fullscreen | searchreplace | help code',
|
||
|
|
||
|
end_container_on_empty_block: true,
|
||
|
promotion: false,
|
||
|
style_formats_autohide: true,
|
||
|
style_formats_merge: true
|
||
|
});
|
||
|
}
|
||
|
document.addEventListener("DOMContentLoaded", function(event) {
|
||
|
// If you want to make the editor accept Markdown or Org mode:
|
||
|
// https://www.tiny.cloud/docs/tinymce/6/content-behavior-options/#text_patterns
|
||
|
// you can add text_patterns:
|
||
|
tinymce_init('{{ element }}', '{{ id }}');
|
||
|
});
|
||
|
/* https://stackoverflow.com/a/74274127 */
|
||
|
document.addEventListener('htmx:afterRequest', function(evt) {
|
||
|
tinymce_init('{{ element }}', '{{ id }}');
|
||
|
});
|
||
|
</script>
|