Skip to content

Commit

Permalink
make sure the input resize
Browse files Browse the repository at this point in the history
  • Loading branch information
gary149 committed Dec 31, 2024
1 parent d1eb533 commit b80e5c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/components/chat/ChatInput.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { browser } from "$app/environment";
import { createEventDispatcher, onMount } from "svelte";
import { createEventDispatcher, onMount, tick } from "svelte";
import HoverTooltip from "$lib/components/HoverTooltip.svelte";
import IconInternet from "$lib/components/icons/IconInternet.svelte";
Expand Down Expand Up @@ -76,7 +76,7 @@
textareaElement.parentElement.style.height = `${newHeight}px`;
}
function handleKeydown(event: KeyboardEvent) {
async function handleKeydown(event: KeyboardEvent) {
if (event.key === "Enter" && !event.shiftKey && !isCompositionOn) {
event.preventDefault();
if (isVirtualKeyboard()) {
Expand All @@ -88,6 +88,8 @@
} else {
if (value.trim() !== "") {
dispatch("submit");
await tick();
adjustTextareaHeight();
}
}
}
Expand Down Expand Up @@ -121,7 +123,7 @@
) satisfies ToolFront[];
</script>

<div class="min-h-full flex-1 max-w-full overflow-hidden" on:paste>
<div class="min-h-full flex-1" on:paste>
<div class="relative w-full min-w-0">
<textarea
enterkeyhint={!isVirtualKeyboard() ? "enter" : "send"}
Expand Down

0 comments on commit b80e5c0

Please sign in to comment.