From: Alexander Ebert Date: Wed, 8 Feb 2017 11:19:42 +0000 (+0100) Subject: Fixed suggestions for user mentions in Firefox X-Git-Tag: 3.0.2~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2370884c5a3694b9545c88fb7f3e95df317f891f;p=GitHub%2FWoltLab%2FWCF.git Fixed suggestions for user mentions in Firefox --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js index 0100a4822c..2ac41f0229 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js @@ -190,13 +190,19 @@ define(['Ajax', 'Environment', 'StringUtil', 'Ui/CloseOverlay'], function(Ajax, return null; } + var container = selection.anchorNode; + if (container.nodeType === Node.TEXT_NODE) { + // work-around for Firefox after suggestions have been presented + container = container.parentNode; + } + // check if there is an '@' within the current range - if (selection.anchorNode.textContent.indexOf('@') === -1) { + if (container.textContent.indexOf('@') === -1) { return null; } // check if we're inside code or quote blocks - var container = selection.anchorNode, editor = this._redactor.core.editor()[0]; + var editor = this._redactor.core.editor()[0]; while (container && container !== editor) { if (['PRE', 'WOLTLAB-QUOTE'].indexOf(container.nodeName) !== -1) { return null;