Преглед изворни кода

【综合】BOTA规避一些crash

tangchao пре 6 месеци
родитељ
комит
4351562c83

+ 9 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Outline.swift

@@ -410,6 +410,15 @@ extension KMLeftSideViewController {
             }
         }
     }
+    
+    public func refreshUIOfOutlineIfNeed() {
+        if self.type.methodType != .Outline {
+            return
+        }
+        Task { @MainActor in
+            self.tocOutlineView.reloadData()
+        }
+    }
 }
 
 // MARK: - Undo & Redo

+ 11 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Search.swift

@@ -139,6 +139,17 @@ extension KMLeftSideViewController {
         self.groupedFindTableView.tableColumn(withIdentifier: kPageColumnId)?.headerCell.title = KMLocalizedString("Page", "Table header title")
         (self.groupedFindTableView.tableColumn(withIdentifier: _kRelevanceColumnId)?.dataCell as? NSCell)?.isEnabled = false
     }
+    
+    public func refreshUIOfSeachListIfNeed() {
+        if self.type.methodType != .Search {
+            return
+        }
+        Task { @MainActor in
+            if self.searchField.stringValue.isEmpty == false {
+                self.search(self.searchField)
+            }
+        }
+    }
 }
 
 // MARK: - Menu

+ 3 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -1031,6 +1031,9 @@ import Cocoa
         
         if let data = editController?.isEdited, data {
             self.leftSideViewController.reloadThumbnailDataIfNeed()
+            self.leftSideViewController.note_reloadDataIfNeed()
+            self.leftSideViewController.refreshUIOfOutlineIfNeed()
+            self.leftSideViewController.refreshUIOfSeachListIfNeed()
         }
     }