KindEditor.plugin('multiimage',function(K){var self=this,name='multiimage',lang=self.lang(name+'.'),formatUploadUrl=K.undef(self.formatUploadUrl,true),uploadJson=K.undef(self.imageUploadJson,''),exteLimit=K.undef(self.imageExteLimit,''),sizeLimit=K.undef(self.imageSizeLimit,''),lengthLimit=K.undef(self.imageLengthLimit,0),filePostName=K.undef(self.filePostName,'imgFile'),uploadPath=self.pluginsPath+'multiimage/uploader.html';var params=['action='+encodeURIComponent(uploadJson),'file='+filePostName,'type='+exteLimit,'size='+sizeLimit,'length='+lengthLimit];uploadPath+='?'+params.join('&');self.plugin.multiImageDialog=function(options){var clickFn=options.clickFn;var html=['<div style="padding:20px;">','<div class="ke-upload"></div>','</div>'].join('');var dialog=self.createDialog({name:name,width:740,height:550,title:self.lang(name),body:html,previewBtn:{name:lang.insertAll,click:function(e){clickFn.call(self,win.getUrlList());}},yesBtn:{name:lang.clearAll,click:function(e){win.removeFiles();}},beforeRemove:function(){if(!K.IE||K.V<=8){win.removeFiles();}
if(doc){doc.write('');}
iframe.remove();}}),div=dialog.div,win,doc;var iframe=K('<iframe name="'+name+'" src="'+uploadPath+'" frameborder="0" scrolling="auto" width="700" height="460"></iframe>');function ready(){win=iframe[0].contentWindow;doc=K.iframeDoc(iframe);}
iframe.bind('load',function(){iframe.unbind('load');if(K.IE){ready();}else{setTimeout(ready,0);}});K('.ke-upload',div).replaceWith(iframe);};self.clickToolbar(name,function(){self.plugin.multiImageDialog({clickFn:function(urlList){if(urlList.length===0){return;}
K.each(urlList,function(i,data){if(self.afterUpload){self.afterUpload.call(self,data.url,data,'multiimage');}
self.exec('insertimage',data.url,data.title,data.width,data.height,data.border,data.align,true);});setTimeout(function(){self.hideDialog().focus();},0);}});});});