Переглянути джерело

【2025】【Protect】标记密文, 空白区域,右键菜单,全选无效 - 修复

lizhe 1 місяць тому
батько
коміт
08cef8d8a1

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

@@ -3399,6 +3399,23 @@ struct KMNMWCFlags {
         listView.updateActiveAnnotations(normalActiveAnnotations)
     }
     
+    @objc func selectAllRedactAnnotation () {
+        var selectAllRedactAnnotation: [CPDFAnnotation] = []
+        for i in 0 ..< listView.document.pageCount {
+            let page = listView.document.page(at: i)
+            let annotations = page?.annotations
+            for j in 0 ..< (annotations?.count ?? 0) {
+                if let an = annotations?[j] as? CPDFAnnotation {
+                    if an.isKind(of: CPDFRedactAnnotation.self) == true {
+                        selectAllRedactAnnotation.append(an)
+                    }
+                }
+            }
+        }
+        listView.updateActiveAnnotations(selectAllRedactAnnotation)
+        listView.setNeedsDisplayForVisiblePages()
+    }
+    
     //MARK: 搜索 & 替换
     func showSearchPopWindow(type: KMNBotaSearchType, keyborad: String?, replaceText: String?, results: [KMSearchMode]) {
         let toolMode = self.listView.toolMode
@@ -6606,7 +6623,11 @@ extension KMMainViewController: ComponentGroupDelegate {
                 }
             }
         } else if (menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_SelectAllText) {
-            listView.selectAll(nil)
+            if self.listView.toolMode == .CRedactToolMode {
+                self.selectAllRedactAnnotation()
+            } else {
+                listView.selectAll(nil)
+            }
         } else if (menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_AddBook) {
             menuItemBookMarkClick_add(sender: nil)
         } else if(menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_TextTool) {