配置文件:
path:{
'baidueditor': 'ueditor1_4_3-utf8-php/uemy',
'bdlang': 'ueditor1_4_3-utf8-php/lang/zh-cn/zh-cn',
'zeroclipboard': 'ueditor1_4_3-utf8-php/third-party/zeroclipboard/ZeroClipboard.min',
},
shim:{
'baidueditor': {
deps: ['ueditor1_4_3-utf8-php/ueditor.config', 'css!ueditor1_4_3-utf8-php/themes/default/css/ueditor']
},
'bdlang':{
deps: ['baidueditor']
}
}
//ueditor.config.js,编辑器所在的目录
window.UEDITOR_HOME_URL = '/Public/js/lib/ueditor1_4_3-utf8-php/';
新建uemy.js
define(function(require){
//将ueditor.all.js全部内容拷贝到这里
return UE;
});
使用:
<script type="text/plain" id="myeditor" name="contents" style="height:300px;">初始化的内容</script>
<script type="text/javascript">
require(['baidueditor', 'zeroclipboard', 'bdlang'], function(UE, zcl){
window.ZeroClipboard = zcl;
var ue = UE.getEditor('myeditor');
})
</script>