added chat:autocomplete:init

v1.18.x
barisusakli 9 years ago
parent 1ad4128649
commit 222ef14d7f

@ -19,6 +19,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.addEventListeners();
Chats.createTagsInput($('[component="chat/messages"] .users-tag-input'), ajaxify.data);
Chats.createAutoComplete($('[component="chat/input"]');
if (env === 'md' || env === 'lg') {
Chats.resizeMainWindow();
@ -212,6 +213,26 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
});
};
Chats.createAutoComplete = function(element) {
var data = {
element: element,
strategies: [],
options: {
zIndex: 20000,
listPosition: function(position) {
this.$el.css(this._applyPlacement(position));
this.$el.css('position', 'absolute');
return this;
}
}
};
$(window).trigger('chat:autocomplete:init', data);
if (data.strategies.length) {
data.element.textcomplete(data.strategies, data.options);
}
};
Chats.createTagsInput = function(tagEl, data) {
tagEl.tagsinput({
confirmKeys: [13, 44],

@ -283,6 +283,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
Chats.addSendHandlers(chatModal.attr('roomId'), chatModal.find('#chat-message-input'), chatModal.find('#chat-message-send-btn'));
Chats.createTagsInput(chatModal.find('.users-tag-input'), data);
Chats.createAutoComplete(chatModal.find('[component="chat/input"]'));
Chats.loadChatSince(chatModal.attr('roomId'), chatModal.find('.chat-content'), 'recent');

Loading…
Cancel
Save