mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(web): update description height when navigating between assets (#14145)
This commit is contained in:
parent
d1085e8a02
commit
1fa0122eda
3 changed files with 22 additions and 22 deletions
|
|
@ -1,7 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { autoGrowHeight } from '$lib/actions/autogrow';
|
||||
import { shortcut } from '$lib/actions/shortcut';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
content?: string;
|
||||
|
|
@ -12,13 +11,9 @@
|
|||
|
||||
let { content = '', class: className = '', onContentUpdate = () => null, placeholder = '' }: Props = $props();
|
||||
|
||||
let textarea: HTMLTextAreaElement | undefined = $state();
|
||||
let newContent = $state(content);
|
||||
|
||||
$effect(() => {
|
||||
if (textarea && newContent.length > 0) {
|
||||
void tick().then(() => autoGrowHeight(textarea));
|
||||
}
|
||||
newContent = content;
|
||||
});
|
||||
|
||||
const updateContent = () => {
|
||||
|
|
@ -30,14 +25,14 @@
|
|||
</script>
|
||||
|
||||
<textarea
|
||||
bind:this={textarea}
|
||||
bind:value={newContent}
|
||||
class="resize-none {className}"
|
||||
onfocusout={updateContent}
|
||||
oninput={(e) => (newContent = e.currentTarget.value)}
|
||||
{placeholder}
|
||||
use:shortcut={{
|
||||
shortcut: { key: 'Enter', ctrl: true },
|
||||
onShortcut: (e) => e.currentTarget.blur(),
|
||||
}}
|
||||
use:autoGrowHeight={{ value: newContent }}
|
||||
data-testid="autogrow-textarea">{content}</textarea
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue