import React, { useState } from "react"; import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import { FileText, Eye, Edit3, Download } from "lucide-react"; import { Button } from "@/components/ui"; interface DocEditorProps { content: string; onChange: (content: string) => void; version?: number; updatedAt?: string; onExport?: (format: "md" | "pdf" | "docx") => void; } export function DocEditor({ content, onChange, version, updatedAt, onExport }: DocEditorProps) { const [mode, setMode] = useState<"edit" | "preview">("edit"); return (
{/* Toolbar */}
{version != null && ( v{version} {updatedAt && ` | ${new Date(updatedAt).toLocaleDateString()}`} )} {onExport && (
)}
{/* Editor / Preview */}
{mode === "edit" ? (