基于UEditor的单独图片上传实现
2015-11-21 00:00
609 查看
摘要: UEditor的单独图片上传
//基于UEditor的单独图片上传 (function($){ $.uploadimages = function(uploadId){ var rand = Math.ceil(Math.random() * 1000) * Math.floor(Math.random() * 100); var editorId = 'upload_images_' +rand + '_ueditor'; $("<div style='display:none;'></div>") .append("<script id='"+editorId+"' type='text/plain'></script>") .appendTo('body'); var _editor = this.getEditor(editorId); _editor.ready(function(){ _editor.setDisabled('insertimage'); _editor.hide(); _editor.addListener('beforeinsertimage',function(t,args){ var url = args[0].src; //alert(t + '['+ uploadId+']:' + url); if(typeof(uploadId) == 'string'){ $('#' + uploadId).val(url); }else if(typeof(uploadId) == 'object'){ $(uploadId).val(url); } }); }); }; $.uploadimages.prototype = { getEditor:function(editorId){ this.editor = UE.getEditor(editorId); return this.editor; }, show:function(){ var _editor = this.editor; var img = _editor.getDialog('insertimage'); img.render(); img.open(); } }; })(jQuery);
相关文章推荐
- ios UIView 和 UIButton边框和阴影设置
- Elasticsearch Span Query跨度查询
- Android 中消息模型的四大核心对象:Message、MessageQueue、Looper、Handler
- GPUImage简单滤镜使用(二)
- 一个简单的创建圆角图像的UIImage扩展实现
- iOS UIScrollView实用之图片轮播 —— HERO博客
- UI 第九天 UITableView
- Confluence 5.X破解安装
- UVA-1584 - Circular Sequence
- iOS开发UI篇—popoverController简单介绍
- 表视图1 (UITabelView)
- 我的iOS学习历程 - UITableView(数据model的使用)
- UIPasteboard的使用
- 1101. Quick Sort (25)
- 1101. Quick Sort (25)
- hdoj2767Proving Equivalences【scc+缩点】
- 独立使用UEditor编辑器图片和文件上传(调用内置第三方插件swfupload)
- iOS开发系列-- UIScrollView
- IOS之UI--自定义按钮实现代理监听点击事件
- PyQt4(使用ui)