From: Alexander Ebert Date: Tue, 13 Sep 2016 11:23:46 +0000 (+0200) Subject: Improved image pasting in IE11 X-Git-Tag: 3.0.0_Beta_1~190 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b8be17d3e485d10820d244ee9e5713436d1ec481;p=GitHub%2FWoltLab%2FWCF.git Improved image pasting in IE11 --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index a3b4a281f7..208d03ef76 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -50,42 +50,42 @@ $.Redactor.prototype.WoltLabPaste = function() { this.paste.detectClipboardUpload = (function (e) { e = e.originalEvent || e; - var clipboard = e.clipboardData; - + var file; if (isIe) { - return (window.clipboardData.files.length > 0); - } - - if (this.detect.isFirefox()) - { - return false; + if (!window.clipboardData.files.length) { + return false; + } + + file = window.clipboardData.files.item(0); } - - // prevent safari fake url - var types = clipboard.types; - // WoltLab modification: `DataTransfer.types` is a `DOMStringList` in Edge - if (Array.isArray(types) && types.indexOf('public.tiff') !== -1) - { - e.preventDefault(); + else if (this.detect.isFirefox()) { return false; } - - if (!clipboard.items || !clipboard.items.length) - { - return; - } - - var cancelPaste = false; - var file = clipboard.items[0].getAsFile(); - if (file === null) - { - if (this.detect.isWebkit() && clipboard.items.length > 1) { - file = clipboard.items[1].getAsFile(); - cancelPaste = true; + else { + var clipboard = e.clipboardData; + + // prevent safari fake url + var types = clipboard.types; + if (Array.isArray(types) && types.indexOf('public.tiff') !== -1) { + e.preventDefault(); + return false; + } + + if (!clipboard.items || !clipboard.items.length) { + return; } + var cancelPaste = false; + file = clipboard.items[0].getAsFile(); if (file === null) { - return false; + if (this.detect.isWebkit() && clipboard.items.length > 1) { + file = clipboard.items[1].getAsFile(); + cancelPaste = true; + } + + if (file === null) { + return false; + } } }