Scroll to bottom of modal on open and message send

This commit is contained in:
Debanjum Singh Solanky
2023-03-29 12:41:33 +07:00
parent 59ff1ae27f
commit 81e98c3079

View File

@@ -40,6 +40,9 @@ export class KhojChatModal extends Modal {
.setClass("khoj-chat-input-button") .setClass("khoj-chat-input-button")
.setCta() .setCta()
.onClick(async () => { await this.getChatResponse(this.result) })); .onClick(async () => { await this.getChatResponse(this.result) }));
// Scroll to bottom of modal, till the send message input box
this.modalEl.scrollTop = this.modalEl.scrollHeight;
} }
generateReference(messageEl: any, reference: string, index: number) { generateReference(messageEl: any, reference: string, index: number) {
@@ -81,6 +84,9 @@ export class KhojChatModal extends Modal {
text: `${message}` text: `${message}`
}) })
// Scroll to bottom after inserting chat messages
this.modalEl.scrollTop = this.modalEl.scrollHeight;
return chat_message_el return chat_message_el
} }