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();
5.完成上述步骤之后,网页中的效果如下所示:
image.png6.通过富文本框添加的内容要在页面中正常显示出来,还需要在显示界面添加如下代码:
{% autoescape off %}
{% endautoescape %}
上述代码添加前:
image.png
添加后:
image.png
网友评论