Skip to content

feat: add PDF collections in History and save All-in-One Cmd+C captures - #420

Merged
lzhgus merged 1 commit into
mainfrom
feat/pdf-history-collections
Nov 26, 2026
Merged

lzhgus merged 1 commit into
mainfrom
feat/pdf-history-collections

Conversation

@lzhgus

@lzhgus lzhgus commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Closes #418

Summary

1. Save All-in-One ⌘C / ⏎ / ⌘⇧C / ⌘S captures to Screenshot History

  • Wired CaptureCoordinator's onCopyRendered and onSaveRendered callbacks to record rendered All-in-One captures into HistoryCoordinator (along with updating settings.lastCaptureSelection and clearing pendingSourceApplication).
  • Left CaptureAllInOneToolbarWindow shortcut routing (#239, #298) and freeze-overlay dismissal (#395) untouched so there is zero regression on annotation object copy, synthetic ⌘C filtering, or dismissal flicker.

2. PDF Collections (Decks) in Screenshot History

  • Storage (HistoryKit):
    • Added GRDB migration v3_add_history_collections (history_collections + history_collection_items) with SQLite foreign keys enabled.
    • Added HistoryCaptureMode.pdfPage so imported PDF pages stay grouped inside collections instead of flooding the flat daily timeline.
    • Protected collection-referenced entries from automatic retention cleanup (deleteOlderThan). Deleting a collection removes orphaned .pdfPage files while preserving regular screenshots.
  • PDF Import (App + SharedKit):
    • Import via Import PDF button in History, dragging .pdf files onto the History window, or Finder Open With → Capso (com.adobe.pdf in Info.plist).
    • Renders each PDF page onto an opaque white high-DPI PNG with progress UI, cancellation, and password prompt for encrypted PDFs.
  • Deck Editing & Export (HistoryView + HistoryCollectionDetailView):
    • Added PDFs filter tab, stacked collection cards (HistoryCollectionCard) with hover Open / Export / Delete actions and rename sheet, and conditional Export PDF (N) for multi-selected screenshots.
    • Deck detail view displays pages in 1 → N order, supports double-click/Edit in AnnotationEditorWindow (in-place update), interleaving screenshots (+ Add Screenshots picker, Add to PDF Collection context menu from main History, ⌘V clipboard paste, or drag-and-drop images/PDFs), drag-to-reorder, and exporting the ordered deck back to a single PDF.

Verification

  • SPM Package Tests:
    • swift test --package-path Packages/SharedKit: 280/280 passed (including partitionPDFsSplitsPDFFiles).
    • swift test --package-path Packages/HistoryKit: 5/5 passed (including collectionsLifecycleAndRetentionProtection).
  • Xcode App Tests (xcodebuild test -project Capso.xcodeproj -scheme Capso -configuration Debug):
    • All 258/258 CapsoTests passed, including:
      • CaptureAllInOneAnnotationShortcutTests (new testAllInOneCommandCRecordsRenderedCaptureToHistory + existing #239/#298 tests)
      • AnnotationCanvasClipboardShortcutTests & SyntheticKeyEventGuardTests
      • HistoryPDFExportTests (new testImportPDFInterleaveScreenshotReorderAndExportBackToPDF)
  • Live Debug Capso.app End-to-End GUI Verification:
    • Opened a multi-page PDF directly with Debug Capso.app → History auto-opened the deck with 3 centered 16:9 slides (1 → 3).
    • Pressed ⌘V to paste a clipboard screenshot as Page 4 (1 → 4).
    • Opened Slide 1 in AnnotationEditorWindow, added a text annotation ("Key Point!"), saved with ⌘S, and confirmed Slide 1 updated in-place both in the deck and as the stacked collection cover thumbnail in the main History view.

Closes #418

- Persist All-in-One rendered captures copied via Cmd+C / Enter / Cmd+Shift+C
  or saved via Cmd+S into Screenshot History without altering the Cmd+C
  shortcut routing (#239, #298) or freeze-overlay dismissal (#395).
- Add HistoryCollection storage in HistoryKit (GRDB migration v3) with
  HistoryCaptureMode.pdfPage, keeping imported PDF pages grouped in decks
  rather than flooding the flat daily timeline, and protecting collection
  members from automatic retention cleanup.
- Support importing PDFs into Screenshot History via Import PDF button,
  drag-and-drop, and Finder Open With (com.adobe.pdf), with progress,
  cancellation, and password-protected PDF prompts.
- Add HistoryCollectionDetailView for ordered 1..N deck editing: open any
  page in AnnotationEditorWindow (updates in-place), interleave screenshots
  via picker / context menu / Cmd+V paste / drag-and-drop, drag to reorder,
  and export the ordered deck back to a single PDF.
@lzhgus
lzhgus merged commit 0431d84 into main Nov 26, 2026
5 checks passed
@lzhgus
lzhgus deleted the feat/pdf-history-collections branch November 26, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 支持打开PDF文件到截图历史,PDF每一页都是一张截图,便于标记

1 participant