mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
added chat:autocomplete:init
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user