requirejs 整合百度编辑器ueditor

时间:2015-07-29 14:14:28   收藏:0   阅读:4982

配置文件:

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>


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!