Skip to content

Commit

Permalink
Autofocus to chat input when openning chat (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuan3w authored Nov 1, 2023
1 parent 9677eae commit 354605e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/interface/obsidian/src/chat_modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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) {
Expand Down

0 comments on commit 354605e

Please sign in to comment.