为什么CKEditor没有出现?

时间:2014-06-16 19:34:10

标签: 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文本区域没有显示?

1 个答案:

答案 0 :(得分:1)

您是否在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>