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() {
const textarea = this.textareaRef.value;
if (textarea) {
// Reset height to auto to get accurate scrollHeight
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() {
const textarea = this.textareaRef.value;
if (textarea) {
// Set initial height properly
this.adjustTextareaHeight();
// Don't adjust height on first render - let it be minimal
textarea.focus();
}
}
override updated() {
// Adjust height when component updates
this.adjustTextareaHeight();
// Only adjust height when component updates if there's content
if (this.value) {
this.adjustTextareaHeight();
}
}
override render() {

View file

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

View file

@ -5,7 +5,7 @@
<title>pi-ai</title>
<link rel="stylesheet" href="app.css" />
</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>
</body>
</html>