From: Alexander Ebert Date: Wed, 25 Jan 2017 16:59:03 +0000 (+0100) Subject: Fixed incorrect range being restored X-Git-Tag: 3.0.2~55 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a6b8595b0429bbc87f6b323c3f5451d905541f1b;p=GitHub%2FWoltLab%2FWCF.git Fixed incorrect range being restored --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js index 850028ba14..01d2411bd7 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js @@ -141,7 +141,14 @@ $.Redactor.prototype.WoltLabCaret = function() { var mpSet = this.buffer.set; this.buffer.set = (function (type) { if (document.activeElement !== editor) { - restoreRange(); + // check if caret is still inside the editor + var selection = window.getSelection(); + if (selection.rangeCount && this.utils.isRedactorParent(selection.anchorNode) !== false) { + editor.focus(); + } + else { + restoreRange(); + } } mpSet.call(this, type);