π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(export): read guide fresh from the database at export time
Luis Ortizc33a8b615159
diff --git a/src/ui/sidepanel/ExportMenu.tsx b/src/ui/sidepanel/ExportMenu.tsxindex 961e72f..5120079 100644--- a/src/ui/sidepanel/ExportMenu.tsx+++ b/src/ui/sidepanel/ExportMenu.tsx@@ -4,6 +4,7 @@ import { i18n } from '#imports';import { exportGuideAsHTML } from '@/core/export/html-export';import { exportGuideAsMarkdown } from '@/core/export/markdown-export';import { exportGuideAsPDF } from '@/core/export/pdf-export';+import { getGuide } from '@/core/guides/service';import type { Guide, Screenshot, Step } from '@/core/guides/types';import { Button } from '@/ui/components/ui/button';@@ -24,7 +25,12 @@ function downloadFile(content: string, filename: string, mimeType: string) {URL.revokeObjectURL(url);}-export default function ExportMenu({ guide, steps, screenshots }: ExportMenuProps) {+export default function ExportMenu({+ guideId,+ guide: guideProp,+ steps: stepsProp,+ screenshots: screenshotsProp,+}: ExportMenuProps) {const [open, setOpen] = useState(false);const [exporting, setExporting] = useState(false);const menuRef = useRef<HTMLDivElement>(null);@@ -41,6 +47,11 @@ export default function ExportMenu({ guide, steps, screenshots }: ExportMenuPropsetOpen(false);setExporting(true);try {+ const fresh = await getGuide(guideId);+ const guide = fresh?.guide ?? guideProp;+ const steps = fresh?.steps ?? stepsProp;+ const screenshots = fresh?.screenshots ?? screenshotsProp;+if (type === 'html') {const html = await exportGuideAsHTML(guide, steps, screenshots);downloadFile(html, `${guide.title}.html`, 'text/html');diff --git a/src/ui/sidepanel/StepCard.tsx b/src/ui/sidepanel/StepCard.tsxindex 7e26276..a2caa6f 100644--- a/src/ui/sidepanel/StepCard.tsx+++ b/src/ui/sidepanel/StepCard.tsx@@ -2,6 +2,7 @@ import { Check, Copy, Trash2 } from 'lucide-react';import { useEffect, useRef, useState } from 'react';import { i18n } from '#imports';import type { Screenshot, Step } from '@/core/guides/types';+import { renderScreenshot } from '@/core/screenshot/render';import { logger } from '@/lib/logger';import ScreenshotView from '@/ui/shared/ScreenshotView';@@ -49,8 +50,8 @@ export default function StepCard({const handleCopy = async () => {if (!screenshot) return;try {- const item = new ClipboardItem({ [screenshot.mimeType]: screenshot.blob });- await navigator.clipboard.write([item]);+ const rendered = await renderScreenshot(screenshot, { format: 'image/png' });+ await navigator.clipboard.write([new ClipboardItem({ 'image/png': rendered })]);setCopied(true);setTimeout(() => setCopied(false), 1500);} catch (err) {