From 4cceefecc0c00f9ae2e2e07c32ef4074c9e990ac Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Fri, 6 Feb 2026 10:40:35 -0500 Subject: [PATCH] fix(editor): fix editor scrolling to prevent page scroll --- frontend/src/components/Editor.tsx | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/Editor.tsx b/frontend/src/components/Editor.tsx index 0ba6597..3881f0a 100644 --- a/frontend/src/components/Editor.tsx +++ b/frontend/src/components/Editor.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useRef } from 'react' +import { useRef } from 'react' interface EditorProps { content: string @@ -10,19 +10,6 @@ interface EditorProps { export function Editor({ content, onChange, placeholder, disabled }: EditorProps) { const textareaRef = useRef(null) - // Auto-resize textarea - const adjustHeight = useCallback(() => { - const textarea = textareaRef.current - if (textarea) { - textarea.style.height = 'auto' - textarea.style.height = `${textarea.scrollHeight}px` - } - }, []) - - useEffect(() => { - adjustHeight() - }, [content, adjustHeight]) - const handleChange = (e: React.ChangeEvent) => { onChange(e.target.value) } @@ -55,11 +42,12 @@ export function Editor({ content, onChange, placeholder, disabled }: EditorProps onKeyDown={handleKeyDown} placeholder={placeholder} disabled={disabled} - className="w-full h-full min-h-full p-6 resize-none outline-none border-none + className="w-full h-full p-6 resize-none outline-none border-none bg-transparent font-mono text-sm leading-relaxed text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-600 - disabled:opacity-50 disabled:cursor-not-allowed" + disabled:opacity-50 disabled:cursor-not-allowed + overflow-auto" spellCheck={false} />