Browse Source

Show imported scan images above editable OCR text.

Imported photos and screenshots were treated as text-only pages, hiding the source image during editing.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 tháng trước cách đây
mục cha
commit
c9b64bd2e9
1 tập tin đã thay đổi với 8 bổ sung9 xóa
  1. 8 9
      smart_printer/ScanFileView.swift

+ 8 - 9
smart_printer/ScanFileView.swift

@@ -272,7 +272,7 @@ struct ParsedScanPage {
     let picture: NSImage
     let caption: String?
     let body: ScanBodyLayout
-    /// When false, the page is text-only — show editable OCR text without a scan preview image.
+    /// When true, the imported scan image is shown above the editable OCR text.
     var showsPicture: Bool
 }
 
@@ -280,15 +280,14 @@ enum ScanDocumentBuilder {
     static let imageContentWidth: CGFloat = 520
     private static let figureCaptionPattern = #"(?:Fig\.|Figure)\s*\d+"#
 
-    /// Recognizes text from a scanned page. Embedded photos with captions keep a picture preview;
-    /// plain text documents show only editable OCR text.
+    /// Recognizes text from a scanned page and shows the image above editable OCR text.
     static func parsePage(from image: NSImage) async -> ParsedScanPage {
         guard let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil) else {
             return ParsedScanPage(
                 picture: image.normalizedForDisplay(),
                 caption: nil,
                 body: .single(NSAttributedString()),
-                showsPicture: false
+                showsPicture: true
             )
         }
 
@@ -323,7 +322,7 @@ enum ScanDocumentBuilder {
             picture: image.normalizedForDisplay(),
             caption: nil,
             body: .single(layoutAttributedText(from: observations)),
-            showsPicture: false
+            showsPicture: true
         )
     }
 
@@ -333,14 +332,14 @@ enum ScanDocumentBuilder {
                 picture: page.image,
                 caption: nil,
                 body: .single(NSAttributedString()),
-                showsPicture: false
+                showsPicture: true
             )
         }
         return ParsedScanPage(
             picture: page.image,
             caption: nil,
             body: .single(plainBodyText(page.text)),
-            showsPicture: false
+            showsPicture: true
         )
     }
 
@@ -812,7 +811,7 @@ private final class ScanPageThumbnailView: NSControl, AppearanceRefreshable {
 
 // MARK: - Editable Scan Content
 
-/// Editable OCR text for scanned documents; embedded photos with captions keep a picture preview.
+/// Shows the imported scan image above editable OCR text.
 final class EditableScanContentView: NSView, AppearanceRefreshable {
     var onRecognitionComplete: (() -> Void)?
 
@@ -1735,7 +1734,7 @@ final class ScanFileOverlayView: NSView, AppearanceRefreshable {
         if pages.count > 1 {
             counterLabel.stringValue = "\(pages.count) documents — select pages below, then print or save"
         } else {
-            counterLabel.stringValue = "Edit recognized text below"
+            counterLabel.stringValue = "Review the image and edit recognized text below"
         }
         counterLabel.isHidden = false
     }