refac: rich text input styling

This commit is contained in:
Timothy J. Baek
2024-10-19 03:15:40 -07:00
parent 6d25d23326
commit e252ca1dc4
6 changed files with 21 additions and 31 deletions

View File

@@ -57,18 +57,14 @@
console.log(prompt);
await tick();
const chatInputElement = document.getElementById('chat-input');
if (chatInputElement) {
chatInputElement.style.height = '';
chatInputElement.style.height = Math.min(chatInputElement.scrollHeight, 200) + 'px';
chatInputElement.focus();
const chatInputContainerElement = document.getElementById('chat-input-container');
if (chatInputContainerElement) {
chatInputContainerElement.style.height = '';
chatInputContainerElement.style.height =
Math.min(chatInputContainerElement.scrollHeight, 200) + 'px';
const words = findWordIndices(prompt);
if (words.length > 0) {
const word = words.at(0);
chatInputElement.setSelectionRange(word?.startIndex, word.endIndex + 1);
}
const chatInputElement = document.getElementById('chat-input');
chatInputElement?.focus();
}
await tick();