From: Alexander Ebert Date: Wed, 18 Jan 2017 10:03:35 +0000 (+0100) Subject: Fixed a few pasting issues X-Git-Tag: 3.0.1~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f3233ec7f8d9ac0bbe1ca470cef8098cc2495776;p=GitHub%2FWoltLab%2FWCF.git Fixed a few pasting issues --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js index cc9eb262f5..0e5472396a 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js @@ -377,6 +377,23 @@ $.Redactor.prototype.WoltLabClean = function() { this.clean.removeSpans = function(html) { return html; }; + + var mpGetCurrentType = this.clean.getCurrentType; + this.clean.getCurrentType = (function(html, insert) { + var data = mpGetCurrentType.call(this, html, insert); + + if (this.utils.isCurrentOrParent(['kbd'])) { + data.inline = false; + data.block = false; + data.encode = true; + data.pre = true; + data.paragraphize = false; + data.images = false; + data.links = false; + } + + return data; + }).bind(this); } } }; diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index d3b3a2df42..3117a675c1 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -87,7 +87,10 @@ $.Redactor.prototype.WoltLabPaste = function() { if (this.detect.isWebkit() && clipboard.items.length > 1) { file = clipboard.items[1].getAsFile(); cancelPaste = true; - e.preventDefault(); + + if (file !== null) { + e.preventDefault(); + } } if (file === null) { @@ -120,6 +123,8 @@ $.Redactor.prototype.WoltLabPaste = function() { var transparentGif = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; var mpInsert = this.paste.insert; this.paste.insert = (function(html, data) { + if (isKbd) data.pre = true; + if (data.pre) { return mpInsert.call(this, html, data); }