Browse Source

【综合】关闭文档细节补充

tangchao 11 months ago
parent
commit
52fea0fb21
1 changed files with 13 additions and 1 deletions
  1. 13 1
      PDF Office/PDF Master/AppDelegate.swift

+ 13 - 1
PDF Office/PDF Master/AppDelegate.swift

@@ -806,7 +806,19 @@ extension AppDelegate : NSMenuDelegate,NSMenuItemValidation {
                 return false
             }
  
-            return !_windowC.browser.activeTabContents().isHome
+            let isHome = _windowC.browser?.activeTabContents()?.isHome ?? false
+            return !isHome
+        }
+        if action == #selector(closeDocument) {
+            guard let _windowC = NSApp.mainWindow?.windowController as? KMBrowserWindowController else {
+                return false
+            }
+            let isNewTab = _windowC.browser?.activeTabContents()?.isNewTab ?? false
+            if isNewTab {
+                return true
+            }
+            let isHome = _windowC.browser?.activeTabContents()?.isHome ?? false
+            return !isHome
         }
         return true
     }