From: Matthias Schmidt Date: Fri, 4 Apr 2014 17:12:48 +0000 (+0200) Subject: Fix issue with editing mentions X-Git-Tag: 2.0.5~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0d139babf3336615eb741bdfac7019095cc91654;p=GitHub%2FWoltLab%2FWCF.git Fix issue with editing mentions --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 776ad46277..5214694837 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -3299,7 +3299,7 @@ WCF.Message.UserMention = Class.extend({ var $range = this._ckEditor.getSelection().getRanges()[0]; // remove the beginning of the username - $range.setStart($range.startContainer, $range.startOffset - this._mentionStart.length); + $range.setStart($range.startContainer, $range.startOffset - (this._mentionStart.length + 1)); $range.deleteContents(); // insert username @@ -3310,7 +3310,7 @@ WCF.Message.UserMention = Class.extend({ else if (username.indexOf(' ') !== -1) { username = "'" + username + "'"; } - this._ckEditor.insertText(username); + this._ckEditor.insertText('@' + username); // add whitespace after username var $element = CKEDITOR.dom.element.createFromHtml(' '); @@ -3319,11 +3319,6 @@ WCF.Message.UserMention = Class.extend({ return $(this).html(); }); - // the @-sign and the entered username are now in seperate text - // nodes which causes issues if the user changes the text - $range.endContainer.$.nodeValue += $range.endContainer.$.nextSibling.nodeValue; - $($range.endContainer.$.nextSibling).remove(); - // make sure that the range in Firefox is that same as in the // other browsers if ($.browser.mozilla) {