|
|
@@ -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
|
|
|
}
|