说明
适用编辑器名称:UEditor
编辑器版本号:1.4.3
经过修改后的版本,直传阿里云OSS上传和本地上传,需要配置文件上传服务地址和OSS签名即可使用。
修改后的编辑器下载地址:https://statics-all.oss-cn-hangzhou.aliyuncs.com/plug-in/ueditor-1.4.3.zip
HTML代码示例
<!DOCTYPE html> <html> <head> <title>编辑器演示</title> <!--ueditor的配置文件--> <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script> <!--ueditor核心文件--> <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"></script> <!--ueditor语言文件--> <script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script> </head> <body> <div id="html_editor_editor">编辑器内容</div> <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script> <script type="text/javascript"> var ue_editor; var ue_editor_attach = {}; ue_editor = UE.getEditor('editor'); ue_editor.addListener('ready', function(editor) { //初始化编辑器内容 ue_editor.setContent($('#html_editor_editor').html(), true); }); //定义后端文件上传服务地址 window.UEDITOR_CONFIG.serverUrl = 'http://proxy-os.aimlt.com/cgibin/Baidueditorupload'; //定义OSS额外请求参数 window.parent.aliossAttachData = 'ErrMsgLang=cn&ApiTicket=ApiTicket&attach=editor_name'; /*定义OSS后端签名地址*/ window.UEDITOR_CONFIG.serverAliOssConfig.open = true; if(window.UEDITOR_CONFIG.serverAliOssConfig.open == true){ window.UEDITOR_CONFIG.serverAliOssConfig.serverSignUrl = 'http://proxy-os.aimlt.com/cgibin/Upload/getAlossSign'; //额外GET参数 window.UEDITOR_CONFIG.serverAliOssConfig.serverSignUrl += (window.UEDITOR_CONFIG.serverAliOssConfig.serverSignUrl.indexOf('?') == -1 ? '?' : '&') + 'ErrMsgLang=cn'; } /*自定义编辑器额外请求参数*/ ue_editor.ready(function() { ue_editor.execCommand('serverparam', ue_editor_attach); }); </script> </body> </html>