From: Alexander Ebert Date: Wed, 17 Sep 2014 10:11:39 +0000 (+0200) Subject: Added support for multi-drop and Safari X-Git-Tag: 2.1.0_Alpha_1~344^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a1fc221fe2d49af66bfbc80ac6ff01d9bfc0a65c;p=GitHub%2FWoltLab%2FWCF.git Added support for multi-drop and Safari --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js index 3a80b6acc0..c6fd016ef0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js @@ -49,7 +49,8 @@ RedactorPlugins.wupload = { } // IE and WebKit set 'Files', Firefox sets 'application/x-moz-file' for files being dragged - if (event.dataTransfer.types[0] !== 'Files' && event.dataTransfer.types[0] !== 'application/x-moz-file') { + // and Safari just provides 'Files' along with a huge list of other stuff + if (event.dataTransfer.types[0] !== 'application/x-moz-file' && event.dataTransfer.types.indexOf('Files') === -1) { this._isFile = false; return; @@ -152,14 +153,19 @@ RedactorPlugins.wupload = { event = event.originalEvent || event; - if (event.dataTransfer && event.dataTransfer.files.length == 1) { + if (event.dataTransfer && event.dataTransfer.files.length) { event.preventDefault(); // reset overlay var $containerID = this.$source.wcfIdentify(); this._revertDropArea(undefined, $containerID); - WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'upload_' + $containerID, { file: event.dataTransfer.files[0] }); + for (var $i = 0; $i < event.dataTransfer.files.length; $i++) { + var $file = event.dataTransfer.files[$i]; + if ($file.type) { + WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'upload_' + $containerID, { file: $file }); + } + } } },