|
发表于 2018-9-4 15:35:46
|
显示全部楼层
var editor = new E(this.getElementByXid("toolBarDiv"), this.getElementByXid("editor"));
this.editor = editor;
editor.customConfig.pasteFilterStyle = false;
editor.customConfig.menus = [ 'head', 'bold', 'foreColor', // 文字颜色
'underline', 'justify', // 对齐方式
'image', // 插入图片
'emoticon', // 表情
'link',// 插入链接
'quote', // 引用
];
var url = "/baas/companyService/picture/pictureUp";
url = require.toUrl(url);
editor.customConfig.uploadImgServer = url; // 上传图片到服务器
editor.customConfig.uploadImgMaxSize = 3 * 1024 * 1024;//允许上传的最大图片为3M
editor.customConfig.uploadImgMaxLength = 1;//一次只能上传一张图片
editor.customConfig.uploadImgHeaders = {
'Accept' : 'text/x-json'
};
editor.create();
你不用专门做成html页面的 你可以就在w页面中使用
这个是我的使用方法···· 也做了图片上传地址和图片的相应设置
引用 是这样引用的 var E = require("./js/wangEditor.min");
this.getElementByXid("toolBarDiv") 这里的 toolBarDiv 就是 xid为 toolBarDiv 的一个div
this.getElementByXid("editor") 就是 xid为 editor的div
我这样创建 工具栏和内容栏是可以分开的···
其他的 就是富文本编辑器的设置了!
我之所以选这个富文本编辑器 就是因为可以自己设置图片上传地址 可以自己操作图片····也能把图片转成64编码存数据库
wex5 自带的 貌似只支持用64编码格式把图片存进数据库 用起来没这个灵活 其他的 你按照wangEditor的文档自己设置就好了
|
|