From: Alexander Ebert Date: Mon, 25 May 2020 19:24:09 +0000 (+0200) Subject: Support for mentions of user groups containing more than one space X-Git-Tag: 5.2.7~42 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9bc62586f853f3a634ad7aac995c6968b21c4e75;p=GitHub%2FWoltLab%2FWCF.git Support for mentions of user groups containing more than one space --- 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 65ec70a03f..2532473ef9 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js @@ -67,7 +67,6 @@ define(['Ajax', 'Environment', 'StringUtil', 'Ui/CloseOverlay'], function(Ajax, default: this._hideDropdown(); return; - break; } event.preventDefault(); @@ -190,7 +189,14 @@ define(['Ajax', 'Environment', 'StringUtil', 'Ui/CloseOverlay'], function(Ajax, range.deleteContents(); range.collapse(true); - var text = document.createTextNode('@' + elData(item, 'username') + '\u00A0'); + // Mentions only allow for one whitespace per match, putting the username in apostrophes + // will allow an arbitrary number of spaces. + var username = elData(item, 'username').trim(); + if (username.split(/\s/g).length > 2) { + username = "'" + username.replace(/'/g, "''") + "'"; + } + + var text = document.createTextNode('@' + username + '\u00A0'); range.insertNode(text); range = document.createRange();