π¬ 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
feat(export): carry alt text into the pdf and replace bare empty-image text
Luis Ortiz87b55ce37921
diff --git a/src/core/export/pdf-export.ts b/src/core/export/pdf-export.tsindex 400a75b..99fa2d9 100644--- a/src/core/export/pdf-export.ts+++ b/src/core/export/pdf-export.ts@@ -173,6 +173,8 @@ export async function exportGuideAsPDF(}doc.addImage(imgDataUrl, 'JPEG', margin + stepIndent, y, imgWidth, imgHeight);+ const altText = screenshot?.edits?.alt || i18n.t('export.stepLabel', [stepNum]);+ doc.text(doc.splitTextToSize(altText, imgWidth), margin + stepIndent, y + 4, { renderingMode: 'invisible' });y += imgHeight + stepSpacing;} else {y += stepSpacing;diff --git a/src/ui/shared/ImagePlaceholder.tsx b/src/ui/shared/ImagePlaceholder.tsxnew file mode 100644index 0000000..4d1ccc8--- /dev/null+++ b/src/ui/shared/ImagePlaceholder.tsx@@ -0,0 +1,21 @@+import { ImageOff } from 'lucide-react';++interface ImagePlaceholderProps {+ label: string;+ ratio?: number;+ className?: string;+}++export default function ImagePlaceholder({ label, ratio, className = '' }: ImagePlaceholderProps) {+ return (+ <div+ className={`flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-secondary/60 ${className}`}+ style={ratio ? { aspectRatio: ratio } : undefined}+ >+ <span className="flex items-center justify-center w-11 h-11 rounded-full bg-card text-muted-foreground shadow-sm">+ <ImageOff size={19} />+ </span>+ <span className="text-[12px] font-semibold text-muted-foreground">{label}</span>+ </div>+ );+}diff --git a/src/ui/shared/ScreenshotView.tsx b/src/ui/shared/ScreenshotView.tsxindex 1c24c22..813783e 100644--- a/src/ui/shared/ScreenshotView.tsx+++ b/src/ui/shared/ScreenshotView.tsx@@ -18,6 +18,7 @@ import {} from '@/ui/components/ui/dropdown-menu';import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover';import ConfirmDialog from '@/ui/shared/ConfirmDialog';+import ImagePlaceholder from '@/ui/shared/ImagePlaceholder';import ReplaceImageDialog from '@/ui/shared/ReplaceImageDialog';interface ScreenshotViewProps {@@ -266,14 +267,7 @@ export default function ScreenshotView({const ratio = baseScreenshot.width && baseScreenshot.height ? baseScreenshot.width / baseScreenshot.height : 16 / 9;if (deleted) {- return (- <div- className={`rounded-lg border border-border bg-secondary flex items-center justify-center text-sm text-muted-foreground ${className}`}- style={{ aspectRatio: ratio }}- >- {i18n.t('screenshotView.imageDeleted')}- </div>- );+ return <ImagePlaceholder label={i18n.t('screenshotView.imageDeleted')} ratio={ratio} className={className} />;}if (!fullUrl) {diff --git a/src/ui/sidepanel/StepCard.tsx b/src/ui/sidepanel/StepCard.tsxindex d5f04ec..f889e16 100644--- a/src/ui/sidepanel/StepCard.tsx+++ b/src/ui/sidepanel/StepCard.tsx@@ -5,6 +5,7 @@ import type { Screenshot, Step } from '@/core/guides/types';import { renderScreenshot } from '@/core/screenshot/render';import { logger } from '@/lib/logger';import ConfirmDialog from '@/ui/shared/ConfirmDialog';+import ImagePlaceholder from '@/ui/shared/ImagePlaceholder';import ScreenshotView from '@/ui/shared/ScreenshotView';interface DragHandleProps {@@ -100,9 +101,10 @@ export default function StepCard({onOpenEditor={onOpenEditor ? (tool) => onOpenEditor(step.id, tool) : undefined}/>) : (- <div className="w-full h-32 flex items-center justify-center text-sm bg-secondary text-purple">- {i18n.t('editor.noScreenshot')}- </div>+ <ImagePlaceholder+ label={i18n.t('editor.noScreenshot')}+ className="w-full h-32 !rounded-none border-x-0 border-t-0"+ />)}<div className="px-3 pt-2 pb-2">