import { X, Printer } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { MarkdownRenderer } from '@/components/preview/MarkdownRenderer'; import { useExportSource } from '@/hooks/use-export-source'; import { ipc } from '@/lib/ipc'; interface Props { onClose: () => void; } export function PrintPreview({ onClose }: Props) { const source = useExportSource(); const handlePrint = async () => { if (!source) return; const html = `
${source.source.replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' }[c] ?? c))}`;
await ipc.print({ html });
};
if (!source) {
return (