From: Alexander Ebert Date: Mon, 12 Sep 2016 13:04:24 +0000 (+0200) Subject: Improved pasting in Chrome X-Git-Tag: 3.0.0_Beta_1~206 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2b6df8a486fbaeef6d9c6ec00831021752f94d08;p=GitHub%2FWoltLab%2FWCF.git Improved pasting in Chrome --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index 52285e2a28..9cf606ab2c 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -62,23 +62,30 @@ $.Redactor.prototype.WoltLabPaste = function() { return false; } - if (!clipboard.items || !clipboard.items.length) { return; } + var isWebkitPaste = false; var file = clipboard.items[0].getAsFile(); if (file === null) { - return false; + if (this.detect.isWebkit() && clipboard.items.length > 1) { + file = clipboard.items[1].getAsFile(); + isWebkitPaste = true; + } + + if (file === null) { + return false; + } } var reader = new FileReader(); reader.readAsDataURL(file); - reader.onload = $.proxy(this.paste.insertFromClipboard, this); + reader.onload = this.paste.insertFromClipboard.bind(this); - return true; + return (isWebkitPaste === false); }).bind(this); this.paste.insertFromClipboard = (function (e) {