From 0d139babf3336615eb741bdfac7019095cc91654 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 4 Apr 2014 19:12:48 +0200 Subject: [PATCH] Fix issue with editing mentions --- wcfsetup/install/files/js/WCF.Message.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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) { -- 2.20.1