diff --git a/src/lib/components/TextEditor.svelte b/src/lib/components/TextEditor.svelte index 8bc02964..014b8144 100644 --- a/src/lib/components/TextEditor.svelte +++ b/src/lib/components/TextEditor.svelte @@ -180,9 +180,8 @@ const updateComment = async (event) => { function handleInput(event) { inputValue = event.target.value; - + /* const textarea = event.target; - if($screenWidth >= 640) { textarea.style.height = 'auto'; @@ -192,6 +191,8 @@ function handleInput(event) { textarea.style.height = 'auto'; textarea.style.height = Math.min(textarea.scrollHeight, 10000) + 'px'; } + */ + } function handleCancel() { @@ -212,6 +213,14 @@ function handleCancel() { } + // Function to adjust textarea height + function adjustHeight() { + if (ref) { + ref.style.height = 'auto'; + ref.style.height = Math.min(ref.scrollHeight, 10000) + 'px'; + } + } + function handleImageInput(event) { imageInput = event.target.files; //console.log(imageInput) @@ -222,6 +231,7 @@ function handleImageInput(event) { $: { if (expandField === true && typeof window !== 'undefined') { ref?.focus() + adjustHeight(); } } @@ -232,7 +242,7 @@ function handleImageInput(event) {