var E = window.wangEditor
var editor1 = new E('#div1', '#div2')
editor1.customConfig.debug = false // 开启或者关闭调试模式
editor1.customConfig.debug = location.href.indexOf('wangeditor_debug_mode=1') > 0
//调试模式, 生产环境中不建议使用true false 来定义是否开始debug , 当url 中带有 wangeditor_debug_mode=1 才会开启 debug 模式
editor1.customConfig.uploadImgServer = '/uploadImages' //上传图片到服务器
editor1.customConfig.uploadImgShowBase64 = true // 使用 base64 保存图片
以上上传图片的方式不能同时存在
editor1.customConfig.showLinkImg = false //是否显示网络图片
editor1.customConfig.uploadImgMaxSize = 3 * 1024 * 1024 //上传图片大小限制
editor1.customConfig.menus = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
'strikeThrough', // 删除线
'foreColor', // 文字颜色
'backColor', // 背景颜色
'link', // 插入链接
'list', // 列表
'justify', // 对齐方式
'quote', // 引用
'emoticon', // 表情
'image', // 插入图片
'table', // 表格
'video', // 插入视频
//'code', 插入代码
'undo', // 撤销
'redo' // 重复
]
editor1.customConfig.onfocus = function () {
//console.log("onfocus")
}
editor1.create()
http://www.wangeditor.com/ 官方网站
推荐一款使用也很方便的富文本编辑器, 图片和文件插件都可以拿出来单独使用
http://kindeditor.net/demo.php kindeditor