🎬 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(editor): reload the step before editing and drop the click target on replace
Luis Ortizd09fbb48a282
diff --git a/src/locales/en.yml b/src/locales/en.ymlindex 46fb10b..f15eeb3 100644--- a/src/locales/en.yml+++ b/src/locales/en.yml@@ -182,6 +182,7 @@ annotationEditor:toolArrow: ArrowtoolText: TexttoolSelect: "Select"+ addTarget: "Add click target"toolRedact: RedacttoolCrop: CropcolorLabel: Colourdiff --git a/src/locales/es.yml b/src/locales/es.ymlindex db8248e..daf815e 100644--- a/src/locales/es.yml+++ b/src/locales/es.yml@@ -182,6 +182,7 @@ annotationEditor:toolArrow: FlechatoolText: TextotoolSelect: "Seleccionar"+ addTarget: "Añadir objetivo de clic"toolRedact: OcultartoolCrop: RecortarcolorLabel: Colordiff --git a/src/locales/fr.yml b/src/locales/fr.ymlindex e66bb7e..4acdfe5 100644--- a/src/locales/fr.yml+++ b/src/locales/fr.yml@@ -182,6 +182,7 @@ annotationEditor:toolArrow: "Flèche"toolText: TextetoolSelect: "Sélectionner"+ addTarget: "Ajouter la cible de clic"toolRedact: MasquertoolCrop: RecadrercolorLabel: Couleurdiff --git a/src/locales/pt-BR.yml b/src/locales/pt-BR.ymlindex 53203eb..c136f77 100644--- a/src/locales/pt-BR.yml+++ b/src/locales/pt-BR.yml@@ -182,6 +182,7 @@ annotationEditor:toolArrow: SetatoolText: TextotoolSelect: "Selecionar"+ addTarget: "Adicionar alvo de clique"toolRedact: OcultartoolCrop: RecortarcolorLabel: Cordiff --git a/src/ui/fullview/GuideContent.tsx b/src/ui/fullview/GuideContent.tsxindex f25c6fc..b812aa9 100644--- a/src/ui/fullview/GuideContent.tsx+++ b/src/ui/fullview/GuideContent.tsx@@ -94,10 +94,14 @@ export default function GuideContent({ guideId, initialStepId, initialTool }: Gu[guideId, loadGuide],);- const handleOpenEditor = useCallback((stepId: string, tool: 'annotate' | 'redact' | 'crop' | 'target') => {- setEditingStepId(stepId);- setEditingTool(tool);- }, []);+ const handleOpenEditor = useCallback(+ async (stepId: string, tool: 'annotate' | 'redact' | 'crop' | 'target') => {+ await loadGuide();+ setEditingStepId(stepId);+ setEditingTool(tool);+ },+ [loadGuide],+ );const handleEditorDone = useCallback((edits: ScreenshotEdits) => {diff --git a/src/ui/shared/AnnotationEditor.tsx b/src/ui/shared/AnnotationEditor.tsxindex 59aa319..450aca8 100644--- a/src/ui/shared/AnnotationEditor.tsx+++ b/src/ui/shared/AnnotationEditor.tsx@@ -7,6 +7,7 @@ import {EyeOff,Minus,MousePointer2,+ MousePointerClick,MoveVertical,Redo2,RotateCcw,@@ -44,6 +45,7 @@ import {ARROW_ENDS,DEFAULT_FONT_SIZE,DEFAULT_LINE_HEIGHT,+ DEFAULT_TARGET_COLOR,FONT_FAMILIES,FONT_FAMILY_ORDER,LINE_WIDTH_ORDER,@@ -53,6 +55,7 @@ import {MIN_FONT_SIZE,MIN_LINE_HEIGHT,} from '@/core/screenshot/types';+import { localStorage } from '@/lib/browser-api';import {DropdownMenu,DropdownMenuContent,@@ -320,6 +323,7 @@ export default function AnnotationEditor({ screenshot, tool, onDone, onCancel }:const [hovering, setHovering] = useState(false);const [anchor, setAnchor] = useState<{ x: number; y: number } | null>(null);const [pulse, setPulse] = useState(0);+ const [defaultTargetColor, setDefaultTargetColor] = useState(DEFAULT_TARGET_COLOR);const [grabbing, setGrabbing] = useState(false);const [fill] = useState('transparent');@@ -359,6 +363,28 @@ export default function AnnotationEditor({ screenshot, tool, onDone, onCancel }:const mode = modeForTool(activeTool);const selected = annotations.find((a) => a.id === selectedId);const selectedTarget = selected?.type === 'target' ? selected : null;+ const hasTarget = annotations.some((a) => a.id === TARGET_ID);++ const addTarget = () => {+ pushHistory();+ const w = Math.min(screenshot.width * 0.25, 260);+ const h = Math.min(screenshot.height * 0.1, 90);+ setAnnotations((prev) => [+ ...prev,+ {+ id: TARGET_ID,+ type: 'target',+ x: (screenshot.width - w) / 2,+ y: (screenshot.height - h) / 2,+ w,+ h,+ color: defaultTargetColor,+ border: 'dashed',+ },+ ]);+ setActiveTool('select');+ setSelectedId(TARGET_ID);+ };const patchSelected = (patch: Record<string, unknown>) => {if (!selectedId || selectedId === TARGET_ID) return;@@ -435,6 +461,12 @@ export default function AnnotationEditor({ screenshot, tool, onDone, onCancel }:setAnchor({ x: b.x + b.width / 2, y: b.y + b.height });}, [selectedId]);+ useEffect(() => {+ localStorage.get(['targetColor']).then((result) => {+ if (result.targetColor) setDefaultTargetColor(result.targetColor as string);+ });+ }, []);+useEffect(() => {if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;let raf = 0;@@ -897,6 +929,20 @@ export default function AnnotationEditor({ screenshot, tool, onDone, onCancel }:</button></Tip>))}+ {!hasTarget && (+ <>+ <span className="w-px h-5 bg-border mx-1.5" />+ <Tip label={i18n.t('annotationEditor.addTarget')}>+ <button+ type="button"+ onClick={addTarget}+ className="flex items-center justify-center w-9 h-8 rounded-lg text-foreground/75 hover:bg-card hover:text-foreground"+ >+ <MousePointerClick size={16} />+ </button>+ </Tip>+ </>+ )}</div><div className="flex-1 flex items-center justify-end gap-1.5">diff --git a/src/ui/shared/ScreenshotView.tsx b/src/ui/shared/ScreenshotView.tsxindex 608b984..1c24c22 100644--- a/src/ui/shared/ScreenshotView.tsx+++ b/src/ui/shared/ScreenshotView.tsx@@ -235,7 +235,7 @@ export default function ScreenshotView({const { width, height } = bitmap;bitmap.close();- const nextEdits: ScreenshotEdits = { ...effectiveEdits };+ const nextEdits: ScreenshotEdits = { ...effectiveEdits, target: null };delete nextEdits.viewport;const nextScreenshot: Screenshot = { ...baseScreenshot, blob: file, mimeType: file.type, width, height };