From b8be17d3e485d10820d244ee9e5713436d1ec481 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 13 Sep 2016 13:23:46 +0200 Subject: [PATCH] Improved image pasting in IE11 --- .../redactor2/plugins/WoltLabPaste.js | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) 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; + } } } -- 2.20.1