From 13dd4f5489ea3f98b48d41f1e4e808696a9095e2 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 1 Sep 2017 17:40:49 +0200 Subject: [PATCH] Fixed pasting issue in Firefox --- .../js/3rdParty/redactor2/plugins/WoltLabInsert.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js index 53e3e6d7d2..1206b2eb1a 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js @@ -12,6 +12,20 @@ $.Redactor.prototype.WoltLabInsert = function() { this.placeholder.hide(); this.core.editor().focus(); + // Firefox may have an incorrect selection if pasting into the editor using the contextual menu + if (this.detect.isFirefox()) { + var selection = this.selection.get(); + if (selection.anchorNode.closest('.redactor-layer') === null) { + this.selection.restore(); + + selection = this.selection.get(); + if (selection.anchorNode.closest('.redactor-layer') === null) { + this.WoltLabCaret.endOfEditor(); + this.selection.save(); + } + } + } + /** @var Element */ var block = this.selection.block(); -- 2.20.1