Browse Source

【fix】【多页签】批量打开多个文档,拖拽其中一个页签到新窗口,窗口会变为灰色

tangchao 9 months ago
parent
commit
299c2e1a61

+ 11 - 5
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -275,7 +275,7 @@ import Cocoa
         }
         
         if (self.document?.isLocked == false) {
-            if self.model.needConvertNotes {
+            if self.model.needConvertNotes && self.tabViewIsDragging() == false {
                 self.showConvertNotesProgress()
             }
             return
@@ -286,7 +286,7 @@ import Cocoa
         if (self.model.password != nil) {
             if self.listView.document.unlock(withPassword: self.model.password) {
                 self.model.isSaveKeyChain = false
-                if self.model.needConvertNotes {
+                if self.model.needConvertNotes && self.tabViewIsDragging() == false {
                     self.showConvertNotesProgress()
                 }
                 return
@@ -294,11 +294,12 @@ import Cocoa
         }
         
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
-            if self.passwordWindow == nil && self.view.window != nil {
+            if self.passwordWindow == nil && self.view.window != nil && self.tabViewIsDragging() == false {
                 self.passwordWindow = KMPasswordInputWindow.openWindow(window: self.view.window!, url: self.document!.documentURL) { [unowned self] result , password in
                     self.passwordWindow = nil
                     if (result == .cancel) {
-                        self.browserWindowController?.browser?.closeTab()
+//                        self.browserWindowController?.browser?.closeTab()
+                        (self.myDocument as? KMMainDocument)?.browser.closeTab()
                         return
                     }
                     self.model.isSaveKeyChain = true
@@ -309,7 +310,7 @@ import Cocoa
                 self.passwordWindow = nil
             }
             
-            if self.model.needConvertNotes {
+            if self.model.needConvertNotes && self.tabViewIsDragging() == false {
                 self.showConvertNotesProgress()
             }
         }
@@ -1963,6 +1964,11 @@ import Cocoa
         }
     }
     
+    func tabViewIsDragging() -> Bool {
+        let level = self.view.window?.level ?? .normal
+        return level == .floating
+    }
+    
     // MARK: - Noti Actions
     
     internal func documentDidUnlockNotification(_ sender: Notification) {