码迷,mamicode.com
首页 > 其他好文 > 详细

百度编辑器独立上图片传配置

时间:2017-07-29 12:58:26      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:view   隐藏   before   input   编辑   tor   ict   name   独立   


第一步
 var _editor = UE.getEditor(‘editor‘);
找一个ue实例化的id input 如
   
第二步实例化而且调用类
var _editor = UE.getEditor(‘upload_ue‘);
       
                _editor.ready(function () {
                     //设置编辑器不可用
                    //_editor.setDisabled();  这个地方要注意 一定要屏蔽
                    //隐藏编辑器,由于不会用到这个编辑器实例。所以要隐藏
                    _editor.hide();
                       
                    //侦听图片上传
                    _editor.addListener(‘beforeinsertimage‘, function (t, arg) {
                   
                        //将地址赋值给对应的input,仅仅去第一张图片的路径
                       
                        var imgs;
                        for(var a in arg){
                            imgs +=arg[a].src+‘,‘;
                        }
                   
                         $("#picture").attr("value", arg[0].src);
                        //图片预览
                         $("#preview").attr("src", arg[0].src);
                    })
                   
                 });
                //弹出图片上传的对话框
                function upImage() {
                     var myImage = _editor.getDialog("insertimage");
                     myImage.open();
                }
第三步写 html
\< input type="text" id="picture" name="pic"   value="<{$info.pic}>"/>
 \< input  type="button" class="datepicker" onclick="upImage();" value="上传图片" />

百度编辑器独立上图片传配置

标签:view   隐藏   before   input   编辑   tor   ict   name   独立   

原文地址:http://www.cnblogs.com/tlnshuju/p/7253984.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!