需求说明
在本次项目中,百度富文本编辑器主要是用来编辑微信公众号页面内容。为了方便运营工作,决定集成135编辑器(自带模板、图片等)。
第一步clone组件代码
首先下载vue-ueditor-wrap源代码安装依赖(github项目主页有使用方法)然后如下:
- ueditor/dialog 下添加135editor文件夹以及内容。
- ueditor文件夹添加135editor.js文件。
ueditor
|--dialogs
|--|--135editor
|--|--|--135EditorDialogPage.html
|--135editor.js
这2步是参考135编辑器说明文档。
第二步组件扩展
修改vue-ueditor-wrap.vue文件中代码如下
_checkDependencies () {
return new Promise((resolve, reject) => {
// 判断ueditor.config.js和ueditor.all.js是否均已加载(仅加载完ueditor.config.js时UE对象和UEDITOR_CONFIG对象存在,仅加载完ueditor.all.js时UEDITOR_CONFIG对象存在,但为空对象)
let scriptsLoaded = !!window.UE135 && !!window.UE && !!window.UEDITOR_CONFIG && Object.keys(window.UEDITOR_CONFIG).length