Django 模板中的 TinyMCE

TinyMCE in a Django template

提问人:Luca-Alexander Thomas 提问时间:11/7/2023 最后编辑:Luca-Alexander Thomas 更新时间:11/7/2023 访问量:14

问:

我正在尝试通过模板在前端的 Django 项目中实现 TinyMCE 文本区域。当我使用js语句时,什么也没发生。

我尝试在“普通”Web服务器上运行相同的代码,并且开箱即用。

这是我的代码:

HTML 文件:


{% extends "base.html" %}
{% load static %}

{% block content %}

<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>

<script>
    tinymce.init({
    selector: 'textarea#content',
    plugins: 'ai tinycomments mentions anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed permanentpen footnotes advtemplate advtable advcode editimage tableofcontents mergetags powerpaste tinymcespellchecker autocorrect a11ychecker typography inlinecss',
    toolbar: 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table mergetags | align lineheight | tinycomments | checklist numlist bullist indent outdent | emoticons charmap | removeformat',
    tinycomments_mode: 'embedded',
    tinycomments_author: 'Author name',
    mergetags_list: [
        { value: 'First.Name', title: 'First Name' },
        { value: 'Email', title: 'Email' },
    ],
    ai_request: (request, respondWith) => respondWith.string(() => Promise.reject("See docs to implement AI Assistant")),
    });
</script>
<textarea id="content"></textarea>



{% endblock content %}

python html django tinymce-6

评论


答: 暂无答案