'use client'; import { useRef } from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { useHTML } from '@/contexts/HTMLContext'; import { DocumentSkeleton } from '@/components/DocumentSkeleton'; interface HTMLViewerProps { className?: string; } export function HTMLViewer({ className = '' }: HTMLViewerProps) { const { currDocData, currDocName } = useHTML(); const containerRef = useRef(null); if (!currDocData) { return ; } // Check if the file is a txt file const isTxtFile = currDocName?.toLowerCase().endsWith('.txt'); return (
{isTxtFile ? ( currDocData ) : ( {currDocData} )}
); }