Autofocus to chat input when openning chat (#524)

This commit is contained in:
Tuan Nguyen 2023-11-02 06:09:45 +07:00 committed by GitHub
parent 9677eae791
commit 354605e73e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ export class KhojChatModal extends Modal {
await this.getChatHistory();
// Add chat input field
contentEl.createEl("input",
const chatInput = contentEl.createEl("input",
{
attr: {
type: "text",
@ -48,10 +48,11 @@ export class KhojChatModal extends Modal {
class: "khoj-chat-input option"
}
})
.addEventListener('change', (event) => { this.result = (<HTMLInputElement>event.target).value });
chatInput.addEventListener('change', (event) => { this.result = (<HTMLInputElement>event.target).value });
// Scroll to bottom of modal, till the send message input box
this.modalEl.scrollTop = this.modalEl.scrollHeight;
chatInput.focus();
}
generateReference(messageEl: any, reference: string, index: number) {