From 693e8fcb1373527ca0c3c5e6c93bb6bb3b7ff1f9 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 26 Jun 2013 14:40:02 +0200 Subject: [PATCH] Adds user mention suggestions (WIP) --- wcfsetup/install/files/js/WCF.Message.js | 379 +++++++++++++++++++++++ 1 file changed, 379 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index f6787eceab..87f823bd16 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -2909,3 +2909,382 @@ WCF.Message.Share.Page = Class.extend({ }, this), 'jsonp'); } }); + +/** + * Handles user mention suggestions in CKEditors. + * + * Important: Objects of this class have to be created before the CKEditor + * is initialized! + */ +WCF.Message.UserMention = Class.extend({ + /** + * name of the class used to get the user suggestions + * @var string + */ + _className: 'wcf\\data\\user\\UserAction', + + /** + * suggestion item index, -1 if none is selected + * @var integer + */ + _itemIndex: -1, + + /** + * current beginning of the mentioning + * @var string + */ + _mentionStart: '', + + /** + * list with user name suggestions + * @var jQuery + */ + _suggestionList: null, + + /** + * Initalizes user suggestions for the CKEditor with the given textarea id. + * + * @param string editorID + */ + init: function(editorID) { + this._textarea = $('#' + editorID); + + this._suggestionList = $('