From 99897e6bdb5e40bd00e51f23a9046c590971514f Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 26 Mar 2014 14:45:12 +0100 Subject: [PATCH] Fixed clicking on a suggestion --- wcfsetup/install/files/js/WCF.Message.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 67c4dd1081..03f15d3d56 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -2954,6 +2954,12 @@ WCF.Message.Share.Page = Class.extend({ * is initialized! */ WCF.Message.UserMention = Class.extend({ + /** + * current caret position + * @var DOMRange + */ + _caretPosition: null, + /** * name of the class used to get the user suggestions * @var string @@ -2990,6 +2996,10 @@ WCF.Message.UserMention = Class.extend({ */ _mentionStart: '', + /** + * redactor instance object + * @var $.Redactor + */ _redactor: null, /** @@ -3028,6 +3038,9 @@ WCF.Message.UserMention = Class.extend({ * @param object event */ _click: function(event) { + // restore caret position + this._redactor.replaceRangesWith(this._caretPosition); + this._setUsername($(event.currentTarget).data('username')); }, @@ -3075,6 +3088,7 @@ WCF.Message.UserMention = Class.extend({ // restore caret position this._redactor.replaceRangesWith($orgRange); + this._caretPosition = $orgRange; return $offsets; }, -- 2.20.1