https://github.com/wangeditor-team/wangEditor
1.引入wangEditor的JS文件,代码如下所示:
<script type="text/javascript" src="//unpkg.com/wangeditor/dist/wangEditor.min.js"></script>
2. 创建富文本编辑框 DOM
<div id="wangEditor"></div>
3. 初始化 wangEditor 对象
<script type="text/javascript">
// 初始化富文本编辑器 start
const E = window.wangEditor;
const editorD = new E("#wangEditor");
// 设置编辑区域高度为 640px
editorD.config.height = 640;
// 配置服务端图片上传地址
editorD.config.uploadImgServer = "/uploadFiles";
editorD.config.uploadFileName = "files";
// 限制图片大小 2M
editorD.config.uploadImgMaxSize = 2 * 1024 * 1024;
// 限制一次最多能传几张图片 一次最多上传 5 个图片
editorD.config.uploadImgMaxLength = 5;
// 隐藏插入网络图片的功能
editorD.config.showLinkImg = false;
editorD.create();
</script>
4. 获取文档内容
var content = editorD.txt.html();
最后
以上就是香蕉方盒最近收集整理的关于wangEditor富文本编辑器的全部内容,更多相关wangEditor富文本编辑器内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复