Flask 使用富文本輸入框


模板

<script src="{{ url_for('static', filename='ckeditor/ckeditor.js') }}"></script>
<script type=text/javascript>
    function CKupdate() {
                for (instance in CKEDITOR.instances)
                    CKEDITOR.instances[instance].updateElement();
    }
</script>
<label>{{ form.ann_content.label }}</label>
            {{ form.ann_content(style="margin: 0px; width: 711px; height: 250px;",class="ckeditor" ,rows="10",cols="80") }}
            <script>
                // 用CKEditor替換<textarea id="editor1">
                // 使用默認配置
                CKEDITOR.replace('ann_content', {
                    enterMode: CKEDITOR.ELEMENT_MODE_REPLACE}
                );
            </script>

提交表單之前先執行

CKupdate()

form里面寫

ann_content = TextAreaField(u'公告內容')

ckeditor下載地址

http://ckeditor.com/download


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM