mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 12:06:17 +02:00
chat fixes
This commit is contained in:
@@ -103,7 +103,7 @@
|
|||||||
"nodebb-theme-harmony": "1.0.0-beta.48",
|
"nodebb-theme-harmony": "1.0.0-beta.48",
|
||||||
"nodebb-theme-lavender": "7.0.7",
|
"nodebb-theme-lavender": "7.0.7",
|
||||||
"nodebb-theme-peace": "2.0.17",
|
"nodebb-theme-peace": "2.0.17",
|
||||||
"nodebb-theme-persona": "13.0.47",
|
"nodebb-theme-persona": "13.0.48",
|
||||||
"nodebb-widget-essentials": "7.0.5",
|
"nodebb-widget-essentials": "7.0.5",
|
||||||
"nodemailer": "6.8.0",
|
"nodemailer": "6.8.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ define('forum/chats', [
|
|||||||
if (!utils.isMobile()) {
|
if (!utils.isMobile()) {
|
||||||
$('.expanded-chat [component="chat/input"]').focus();
|
$('.expanded-chat [component="chat/input"]').focus();
|
||||||
}
|
}
|
||||||
messages.updateTextAreaHeight();
|
messages.updateTextAreaHeight($(`[component="chat/messages"][data-roomid="${ajaxify.data.roomId}"]`));
|
||||||
}
|
}
|
||||||
$('.chats-list li').removeClass('active');
|
$('.chats-list li').removeClass('active');
|
||||||
$('.chats-list li[data-roomid="' + ajaxify.data.roomId + '"]').addClass('active');
|
$('.chats-list li[data-roomid="' + ajaxify.data.roomId + '"]').addClass('active');
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ define('forum/chats/messages', [
|
|||||||
if (!message.trim().length) {
|
if (!message.trim().length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const chatContent = inputEl.parents(`[component="chat/messages"][data-roomid="${roomId}"]`);
|
||||||
inputEl.val('').trigger('input');
|
inputEl.val('').trigger('input');
|
||||||
inputEl.removeAttr('data-mid');
|
inputEl.removeAttr('data-mid');
|
||||||
messages.updateRemainingLength(inputEl.parent());
|
messages.updateRemainingLength(inputEl.parent());
|
||||||
messages.updateTextAreaHeight();
|
messages.updateTextAreaHeight(chatContent);
|
||||||
const payload = { roomId, message, mid };
|
const payload = { roomId, message, mid };
|
||||||
({ roomId, message, mid } = await hooks.fire('filter:chat.send', payload));
|
({ roomId, message, mid } = await hooks.fire('filter:chat.send', payload));
|
||||||
|
|
||||||
@@ -61,14 +61,18 @@ define('forum/chats/messages', [
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
messages.updateTextAreaHeight = function () {
|
messages.updateTextAreaHeight = function (chatContentEl) {
|
||||||
// https://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize
|
// https://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize
|
||||||
const textarea = $('.expanded-chat [component="chat/input"]');
|
const textarea = chatContentEl.find('[component="chat/input"]');
|
||||||
const scrollHeight = textarea.prop('scrollHeight');
|
const scrollHeight = textarea.prop('scrollHeight');
|
||||||
textarea.css({ height: scrollHeight + 'px', 'overflow-y': 'hidden' });
|
textarea.css({ height: scrollHeight + 'px', 'overflow-y': 'hidden' });
|
||||||
textarea.on('input', function () {
|
textarea.on('input', function () {
|
||||||
|
const isAtBottom = messages.isAtBottom(chatContentEl.find('.chat-content'));
|
||||||
textarea.css({ height: 0 });
|
textarea.css({ height: 0 });
|
||||||
textarea.css({ height: textarea.prop('scrollHeight') + 'px' });
|
textarea.css({ height: textarea.prop('scrollHeight') + 'px' });
|
||||||
|
if (isAtBottom) {
|
||||||
|
messages.scrollToBottom(chatContentEl.find('.chat-content'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ define('chat', [
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
scrollStop.apply(chatModal.find('[component="chat/messages"]'));
|
scrollStop.apply(chatModal.find('[component="chat/messages"] .chat-content'));
|
||||||
|
|
||||||
chatModal.find('#chat-close-btn').on('click', function () {
|
chatModal.find('#chat-close-btn').on('click', function () {
|
||||||
module.close(uuid);
|
module.close(uuid);
|
||||||
|
|||||||
Reference in New Issue
Block a user