美文网首页
Django 引入富文本框

Django 引入富文本框

作者: 零_WYF | 来源:发表于2017-12-16 17:04 被阅读154次

1.下载地址:http://ueditor.baidu.com/website/download.html

image.png

选择任意版本即可,这里我用的是jsp版本,
解压后得到如下所示的文件:


image.png

2.在已有的项目中引入富文本框

将解压后的文件放入项目中的static静态文件中:


image.png

3.在页面中加入富文本框

<script id="editor" type="text/plain" style="width:800px;height:300px;"></script>


image.png

4.初始化编辑器

var ue = UE.getEditor('editor');
获取富文本框中的值用:var $content = ue.getContent();

image.png

5.完成上述步骤之后,网页中的效果如下所示:

image.png

6.通过富文本框添加的内容要在页面中正常显示出来,还需要在显示界面添加如下代码:

{% autoescape off %}
{% endautoescape %}
上述代码添加前:


image.png

添加后:


image.png

相关文章

网友评论

      本文标题:Django 引入富文本框

      本文链接:https://www.haomeiwen.com/subject/vlgswxtx.html