feat: arrowup edit message shortcut

This commit is contained in:
Timothy J. Baek 2024-01-01 10:57:27 -08:00
parent b42050fec8
commit 7d859141b4
2 changed files with 24 additions and 2 deletions

View file

@ -298,6 +298,24 @@
submitPrompt(prompt);
}
}}
on:keydown={(e) => {
if (prompt === '' && e.key == 'ArrowUp') {
e.preventDefault();
const userMessageElement = [
...document.getElementsByClassName('user-message')
]?.at(-1);
const editButton = [
...document.getElementsByClassName('edit-user-message-button')
]?.at(-1);
console.log(userMessageElement);
userMessageElement.scrollIntoView({ block: 'center' });
editButton?.click();
}
}}
rows="1"
on:input={(e) => {
e.target.style.height = '';