From: Alexander Ebert Date: Fri, 9 Apr 2021 16:48:41 +0000 (+0200) Subject: Detection of pasted blob uris in iOS X-Git-Tag: 5.3.6~21 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c8ed211401d8d07b57b68c3abbb0df4dfba9358;p=GitHub%2FWoltLab%2FWCF.git Detection of pasted blob uris in iOS --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index beebe1dec7..d97b619f26 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -351,7 +351,7 @@ $.Redactor.prototype.WoltLabPaste = function() { if (!data.pre && !data.text) { elBySelAll('img', div, (function(img) { var src = img.src; - if (src.indexOf('data:image') === 0 && src !== transparentGif) { + if ((src.indexOf('data:image') === 0 | src.indexOf("blob:") === 0) && src !== transparentGif) { img.src = transparentGif; var uuid = WCF.getUUID(); @@ -397,10 +397,24 @@ $.Redactor.prototype.WoltLabPaste = function() { img.parentNode.removeChild(img); } else { - WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'pasteFromClipboard_' + this.$element[0].id, { - blob: this.utils.dataURItoBlob(imgData.src), - replace: img - }); + if (imgData.src.indexOf("blob:") === 0) { + window.fetch(imgData.src) + .then(function (response) { + return response.blob(); + }) + .then((function (blob) { + WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'pasteFromClipboard_' + this.$element[0].id, { + blob: blob, + replace: img + }); + }).bind(this)); + } + else { + WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'pasteFromClipboard_' + this.$element[0].id, { + blob: this.utils.dataURItoBlob(imgData.src), + replace: img + }); + } } } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/FileUtil.js b/wcfsetup/install/files/js/WoltLabSuite/Core/FileUtil.js index a7390b3ced..d356f98914 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/FileUtil.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/FileUtil.js @@ -122,7 +122,13 @@ define(['Dictionary', 'StringUtil'], function(Dictionary, StringUtil) { // word 'application/msword': 'doc', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx', - 'application/vnd.oasis.opendocument.text': 'odt' + 'application/vnd.oasis.opendocument.text': 'odt', + + // iOS + 'public.jpeg': 'jpeg', + 'public.png': 'png', + 'com.compuserve.gif': 'gif', + 'org.webmproject.webp': 'webp' }); return {