From: Alexander Ebert Date: Thu, 6 Jul 2017 17:46:11 +0000 (+0200) Subject: Fixed mention handling X-Git-Tag: 3.0.7~3^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=95f924a5b0f5fd74731f465a406c199ccb8e4d0a;p=GitHub%2FWoltLab%2FWCF.git Fixed mention handling --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 000745b9bb..446525ba31 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -3642,15 +3642,9 @@ WCF.Message.UserMention = Class.extend({ var $startContainer = $orgRange.startContainer; var $startOffset = $orgRange.startOffset; - // start container might be the parent when inside a list item - if ($startContainer.nodeName === 'LI' && $startOffset === 1) { - $startContainer = $startContainer.lastChild; - $startOffset = $startContainer.textContent.length - 1; - } - // check if `$startContainer` is an element, as it causes `$startOffset` to be // relative to the child nodes instead of the actual text length - if ($startContainer.nodeType === Node.ELEMENT_NODE && $startOffset > 0) { + while ($startContainer.nodeType === Node.ELEMENT_NODE && $startOffset > 0) { $startContainer = $startContainer.childNodes[$startOffset - 1]; $startOffset = $startContainer.textContent.length; }