javascript - 为什么 CKEditor 没有出现?

标签 javascript django

这是我的 html:

<div>
    {% for simpler in post.simpler_set.all %}
        {% if simpler.coeficient == i %} {% autoescape off %}
        <div class="jumbotron {{simpler.parent_list}}" id="{{simpler.id}}"style="display:{{simpler.display}};">{{simpler.author}}: <br/><br/>
            {{simpler.simpler}}
            <div align="right">
                <button type="button" class = "btn btn-success reqsimp" id="{{simpler.id}}">Ask for Simpler.</button>
            </div>
            <div align="right">
                <h3>
                    <div style="padding-right:20px;color:#808080;" class="glyphicon glyphicon-chevron-down"></div>
                    <div class="glyphicon glyphicon-align-center" style="padding-right:20px;color:#808080;"></div>
                    <div class="glyphicon glyphicon-chevron-up" style="color:#808080; display:none; padding-right:20px;"></div>
                    <div class="glyphicon glyphicon-trash" style="color:#808080; padding-right:20px;"></div>
                    <div class="glyphicon glyphicon-ok" style="color:#808080; padding-right:20px; display:none;"></div>
                    <div class="glyphicon glyphicon-remove" style="color:#808080; padding-right:20px; display:none;"></div>
                </h3>
            </div>
            <div align="center">
                <textarea class="ckeditor" cols="80" rows="8" style='display:none;'></textarea></input>{% csrf_token %}
            </div>
            <div align="center">
                <button type="button" data-post='{{post.id}}' class="btn-primary addsimp" id="{{simpler.id}}" align="center" style="display:none;">Add Simpler.</button>
            </div>
        </div> {% endautoescape %}

我已在此 django 模板中包含 ckeditor.js

我已将 ckeditor 类添加到文本区域。

为什么 CKeditor 文本区域不显示?

最佳答案

您是否在 html 中添加了此脚本?

<script>               
   CKEDITOR.replace( '.ckeditor');
</script>

<script type="text/javascript">
    //For configuring toolbar, not necessary if I remember correctly
    CKEDITOR.editorConfig = function( config )
    {
       config.toolbar = 'MyToolbar';
       config.toolbar_MyToolbar = 
          [       
             ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Scayt', 'image'],
             ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat']
          ];
    };
</script>

关于javascript - 为什么 CKEditor 没有出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24250867/

相关文章:

python - 选择一个有效的选项。 XYZ 不是可用选项之一

django - 使用基于通用类的 View 编写 Django 详细信息 View

python - Django 管理服务器在 127.0.0.1 :<port>/admin/URL is hit 时关闭

javascript - 从父窗口加载内容到子窗口

javascript - 将 jQueryUI 对话框的高度调整为与内容一样高,达到最大值

javascript - 上传多个文件并显示进度条

python - 在 Sublime Text 3 中使用 Anaconda 自动完成 Django

javascript - 尝试解决javascript中异步代码引起的问题

javascript - 在 React 组件生命周期中什么时候可以执行路由更改?

JavaScript NodeJs - 如何重构这一点