From: Alexander Ebert Date: Fri, 16 Aug 2019 14:31:11 +0000 (+0200) Subject: Fixed the auto insert of pasted/dropped images in the editor X-Git-Tag: 5.2.0_Alpha_4~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2435a4e918503608cbe6ae4951010de9810b0bb5;p=GitHub%2FWoltLab%2FWCF.git Fixed the auto insert of pasted/dropped images in the editor --- diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index 34cf0c4720..a653f0888e 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -172,22 +172,24 @@ if (COMPILER_TARGET_DEFAULT) { // show tab this._fileListSelector.closest('.messageTabMenu').messageTabMenu('showTab', 'attachments', true); + var callbackUploadId = (function(uploadId) { + if (replace === null) { + this._autoInsert.push(uploadId); + } + else { + this._replaceOnLoad[uploadId] = replace; + } + + data.uploadID = uploadId; + }).bind(this); + if (data.file) { - $uploadID = this._upload(undefined, data.file); + $uploadID = this._upload(undefined, data.file, undefined, callbackUploadId); } else { - $uploadID = this._upload(undefined, undefined, data.blob); + $uploadID = this._upload(undefined, undefined, data.blob, callbackUploadId); replace = data.replace || null; } - - if (replace === null) { - this._autoInsert.push($uploadID); - } - else { - this._replaceOnLoad[$uploadID] = replace; - } - - data.uploadID = $uploadID; }, /** @@ -291,7 +293,7 @@ if (COMPILER_TARGET_DEFAULT) { /** * @see WCF.Upload._upload() */ - _upload: function (event, file, blob) { + _upload: function (event, file, blob, callbackUploadId) { var _super = this._super.bind(this); require([ @@ -407,6 +409,10 @@ if (COMPILER_TARGET_DEFAULT) { this._createButton(); } + if (typeof callbackUploadId === 'function') { + callbackUploadId(uploadID); + } + return uploadID; }).bind(this)) .catch(function (error) {