From 221e254ea1ef33cea55bace31557b239d18635d6 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 6 Sep 2022 13:41:38 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-12683=20feat:=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=20,=20bi.file=20reset=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=89=8D=E4=B8=80=E6=AC=A1=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=9A=84files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/editor/editor.multifile.js | 3 ++- src/base/single/input/file.js | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/base/single/editor/editor.multifile.js b/src/base/single/editor/editor.multifile.js index 21765474d..2be8de9d2 100644 --- a/src/base/single/editor/editor.multifile.js +++ b/src/base/single/editor/editor.multifile.js @@ -43,12 +43,14 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { }); this.file.on(BI.File.EVENT_ERROR, function () { self.fireEvent(BI.MultifileEditor.EVENT_ERROR, arguments); + self._reset(); }); this.file.on(BI.File.EVENT_PROGRESS, function () { self.fireEvent(BI.MultifileEditor.EVENT_PROGRESS, arguments); }); this.file.on(BI.File.EVENT_UPLOADED, function () { self.fireEvent(BI.MultifileEditor.EVENT_UPLOADED, arguments); + self._reset(); }); BI.createWidget({ @@ -93,7 +95,6 @@ BI.MultifileEditor = BI.inherit(BI.Widget, { }, upload: function () { - this._reset(); this.file.upload(); }, diff --git a/src/base/single/input/file.js b/src/base/single/input/file.js index 290970141..a17bb4955 100644 --- a/src/base/single/input/file.js +++ b/src/base/single/input/file.js @@ -56,7 +56,7 @@ del: document.removeEventListener ? function (node, name, callback) { node.removeEventListener(name, callback, false); - + return this; } : function (node, name, callback) { @@ -113,8 +113,8 @@ if (isFunction(handler.onerror)) { handler.onerror(); } - - return; + + return; } for (var xhr = new XMLHttpRequest, upload = xhr.upload || { @@ -245,7 +245,7 @@ form.append("FileData", handler.file); xhr.send(form); } - + return handler; }; } else { @@ -298,7 +298,7 @@ handler.onload(rpe, { responseText: responseText }); } } - + try { // IE < 8 does not accept enctype attribute ... var form = document.createElement("
"), iframe = handler.iframe || (handler.iframe = document.createElement("")); @@ -353,7 +353,7 @@ }; } xhr = null; - + return sendFile; }(Object.prototype.toString)); @@ -705,6 +705,7 @@ reset: function () { if (this.wrap) { + this.wrap.files = []; this.wrap.attach_array = []; this.wrap.attach_names = []; this.wrap.attachNum = 0;