Spaces:
Sleeping
Sleeping
[Fix] dynamic textarea reset when toggling between code snippets and input messages
Browse files1234456715 unmodified lines2324252626272829303126 unmodified lines5859606162636465<script lang="ts"> import type { Conversation } from "$lib/components/InferencePlayground/types";
import { createEventDispatcher } from "svelte"; import { createEventDispatcher, tick } from "svelte";
import CodeSnippets from "./InferencePlaygroundCodeSnippets.svelte"; import Message from "./InferencePlaygroundMessage.svelte";15 unmodified lines
let messageContainer: HTMLDivElement | null = null;
function resizeMessageTextAreas() { async function resizeMessageTextAreas() { // ideally we would use CSS "field-sizing:content". However, it is currently only supported on Chrome. await tick(); if (messageContainer) { const containerScrollTop = messageContainer.scrollTop; const textareaEls = messageContainer.querySelectorAll("textarea");26 unmodified lines conversationLength = conversation.messages.length; shouldScrollToBottom = true; }
$: viewCode, resizeMessageTextAreas();</script>
<divsrc/lib/components/InferencePlayground/InferencePlaygroundConversation.svelte+5-2