fix(file-preview): fix TOC Top/Bottom scroll using correct container

The scroll function was targeting markdownContainerRef (inner content div)
instead of contentRef (the actual scrollable parent container).
This commit is contained in:
Pedram Amini
2026-02-01 10:13:23 -05:00
parent d914470918
commit c1da1711e6

View File

@@ -655,7 +655,8 @@ export const FilePreview = forwardRef<FilePreviewHandle, FilePreviewProps>(funct
const scrollMarkdownToBoundary = useCallback(
(direction: 'top' | 'bottom') => {
const container = markdownContainerRef.current;
// Use contentRef which is the actual scrollable container
const container = contentRef.current;
if (!container) return;
const top = direction === 'top' ? 0 : container.scrollHeight;
container.scrollTo({ top, behavior: 'smooth' });