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
+6 -12
View File
@@ -330,20 +330,14 @@
await tick();
const chatInputElement = document.getElementById('chat-input');
if (chatInputElement) {
const chatInputContainerElement = document.getElementById('chat-input-container');
if (chatInputContainerElement) {
prompt = p;
chatInputElement.style.height = '';
chatInputElement.style.height = Math.min(chatInputElement.scrollHeight, 200) + 'px';
chatInputElement.focus();
const words = findWordIndices(prompt);
if (words.length > 0) {
const word = words.at(0);
chatInputElement.setSelectionRange(word?.startIndex, word.endIndex + 1);
}
chatInputContainerElement.style.height = '';
chatInputContainerElement.style.height =
Math.min(chatInputContainerElement.scrollHeight, 200) + 'px';
chatInputContainerElement.focus();
}
await tick();