浏览代码

【2025】【OCR】 Edit,OCR弹窗,应该是模态弹窗(现在是Window)修复

lizhe 1 月之前
父节点
当前提交
6707dd2fbf

+ 7 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -3544,7 +3544,13 @@ extension KMMainViewController {
             self.convertOCRScanFile(window: window, document: self.listView.document, model: model)
         }
         
-        self.km_beginSheet(windowC: window)
+        window.cancelAction = {[unowned self] controller in
+            self.view.window?.endSheet(window.window ?? NSWindow())
+        }
+        
+        self.view.window?.beginSheet(window.window ?? NSWindow())
+        
+//        self.km_beginSheet(windowC: window)
     }
     
     func showOCREditAlert() {

+ 5 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/OCR/Edit/Window/KMOCRSettingWindowController.swift

@@ -8,12 +8,14 @@
 import Cocoa
 
 typealias KMOCRSettingWindowControllerOCRAction = (_ controller: KMOCRSettingWindowController, _ model: KMOCRModel) -> Void
+typealias KMOCRSettingWindowControllerCancelAction = (_ controller: KMOCRSettingWindowController) -> Void
 
 class KMOCRSettingWindowController: KMNBaseWindowController {
 
     @IBOutlet weak var OCRSettingView: KMOCRSettingView!
     
     var OCRAction: KMOCRSettingWindowControllerOCRAction?
+    var cancelAction: KMOCRSettingWindowControllerCancelAction?
     
     override func windowDidLoad() {
         super.windowDidLoad()
@@ -23,7 +25,9 @@ class KMOCRSettingWindowController: KMNBaseWindowController {
     
     func updateUI() {
         OCRSettingView.cancelAction = { [unowned self] view in
-            self.closeWindow()
+            guard let callBack = cancelAction else { return }
+            
+            callBack(self)
         }
         
         OCRSettingView.OCRAction = { [unowned self] view, model in