From f63695d65663ef49923707a20ec8788c1e2de4bb Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 5 Mar 2021 15:07:46 +0800 Subject: [PATCH] roojs-bootstrap.js roojs-bootstrap-debug.js --- roojs-bootstrap-debug.js | 6 +++--- roojs-bootstrap.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 8fd7fcc326..8968fed65c 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -12756,10 +12756,10 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { var _t = this; var reader = new FileReader(); - reader.onloadend = function(evt) { - data.srcdata = evt.target.result; + reader.addEventListener("load", function() { + data.srcdata = reader.result; _t.updateInput(); - }; + }); reader.readAsDataURL(data.src); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 5a4302be58..12841dea22 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -528,8 +528,8 @@ this.selectorEl=this.el.select('.roo-card-upload-selector',true).first();this.se },this);},addFile:function(A){if(typeof(A)==='string'){throw "Add file by name?";return;}if(!A||!this.urlAPI){return;}var B=this;var C=B.urlAPI.createObjectURL(A);this.addCard({id:Roo.bootstrap.CardUploader.ID--,is_uploaded:false,src:C,title:A.name,mimetype:A.type,preview:false,is_deleted:0} )},addCard:function(A){var t=this;var B=[{xns:Roo.bootstrap,xtype:'CardFooter',items:[{xns:Roo.bootstrap,xtype:'Element',cls:'d-flex',items:[{xns:Roo.bootstrap,xtype:'Button',html:String.format("{0}",A.title),cls:'col-11 text-left',size:'sm',weight:'link',fa:'download',listeners:{click:function(){this.downloadCard(A.id)} }},{xns:Roo.bootstrap,xtype:'Button',size:'sm',weight:'danger',cls:'col-1',fa:'times',listeners:{click:function(){t.removeCard(A.id)}}}]}]}];var cn=this.addxtype({xns:Roo.bootstrap,xtype:'Card',closeable:true,header:!A.mimetype.match(/image/)&&!A.preview?"Document":false,header_image:A.mimetype.match(/image/)?A.src:A.preview,header_image_fit_square:true,data:A,html:false,items:B,initEvents:function(){Roo.bootstrap.Card.prototype.initEvents.call(this); -this.imgEl=this.el.select('.card-img-top').first();if(this.imgEl){this.imgEl.on('click',function(){t.previewCard(A.id);},this);this.imgEl.set({'pointer':'cursor'});}}});this.fileCollection.add(cn);var _t=this;var C=new FileReader();C.onloadend=function(D){A.srcdata=D.target.result; -_t.updateInput();};C.readAsDataURL(A.src);},removeCard:function(id){var A=this.fileCollection.get(id);A.data.is_deleted=1;A.data.src='';this.fileCollection.remove(A);A.el.dom.parentNode.removeChild(A.el.dom);},reset:function(){this.fileCollection.each(function(A){A.el.dom.parentNode.removeChild(A.el.dom); +this.imgEl=this.el.select('.card-img-top').first();if(this.imgEl){this.imgEl.on('click',function(){t.previewCard(A.id);},this);this.imgEl.set({'pointer':'cursor'});}}});this.fileCollection.add(cn);var _t=this;var C=new FileReader();C.addEventListener("load",function(){A.srcdata=C.result; +_t.updateInput();});C.readAsDataURL(A.src);},removeCard:function(id){var A=this.fileCollection.get(id);A.data.is_deleted=1;A.data.src='';this.fileCollection.remove(A);A.el.dom.parentNode.removeChild(A.el.dom);},reset:function(){this.fileCollection.each(function(A){A.el.dom.parentNode.removeChild(A.el.dom); });this.fileCollection.clear();this.updateInput();},updateInput:function(){var A=[];this.fileCollection.forEach(function(e){A.push(e.data);});this.inputEl().dom.value=JSON.stringify(A);}});Roo.bootstrap.CardUploader.ID=-1; // Roo/data/SortTypes.js Roo.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase(); -- 2.39.2