This commit is contained in:
Mario Zechner 2025-10-01 18:35:02 +02:00
parent d0b2d47b4a
commit fc1ef04b6d
3 changed files with 12 additions and 6 deletions

View file

@ -125,23 +125,28 @@ export class MessageEditor extends LitElement {
private adjustTextareaHeight() { private adjustTextareaHeight() {
const textarea = this.textareaRef.value; const textarea = this.textareaRef.value;
if (textarea) { if (textarea) {
// Reset height to auto to get accurate scrollHeight
textarea.style.height = "auto"; textarea.style.height = "auto";
textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`; // Only adjust if there's content, otherwise keep minimal height
if (this.value.trim()) {
textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
}
} }
} }
override firstUpdated() { override firstUpdated() {
const textarea = this.textareaRef.value; const textarea = this.textareaRef.value;
if (textarea) { if (textarea) {
// Set initial height properly // Don't adjust height on first render - let it be minimal
this.adjustTextareaHeight();
textarea.focus(); textarea.focus();
} }
} }
override updated() { override updated() {
// Adjust height when component updates // Only adjust height when component updates if there's content
this.adjustTextareaHeight(); if (this.value) {
this.adjustTextareaHeight();
}
} }
override render() { override render() {

View file

@ -182,6 +182,7 @@ export class ApiKeysDialog extends DialogBase {
` `
: "" : ""
} }
<!-- test-->
<!-- Scrollable content --> <!-- Scrollable content -->
<div class="flex-1 overflow-y-auto p-6"> <div class="flex-1 overflow-y-auto p-6">

View file

@ -5,7 +5,7 @@
<title>pi-ai</title> <title>pi-ai</title>
<link rel="stylesheet" href="app.css" /> <link rel="stylesheet" href="app.css" />
</head> </head>
<body class="h-full w-full m-0 overflow-hidden"> <body class="h-full w-full m-0 overflow-hidden bg-background">
<script type="module" src="sidepanel.js"></script> <script type="module" src="sidepanel.js"></script>
</body> </body>
</html> </html>