Browse Source

【2025】【综合】
1、AI功能跳转完善
2、弹窗组件库跳转

niehaoyu 1 month ago
parent
commit
bbd2ad3bc5

+ 11 - 2
PDF Office/KMComponentLibrary/KMComponentLibrary/View/GroupItem/ComponentGroup.swift

@@ -34,6 +34,7 @@ public class ComponentGroup: NSView, NibLoadable {
     
     public var clickedAutoHide = true //点击Item后,是否自动隐藏
     
+    var superGroupView: ComponentGroup?
     var subGroupView: ComponentGroup!
     
     var choosedIndex: Int = -1
@@ -313,6 +314,8 @@ public class ComponentGroup: NSView, NibLoadable {
             return
         }
         subGroupView.showSubGroupWithPoint(point)
+        subGroupView.superGroupView = self
+        
     }
     
     //MARK: - Private Method
@@ -416,8 +419,14 @@ extension ComponentGroup: NSCollectionViewDataSource {
             DispatchQueue.main.async {
                 let property = view.properties
                 if self?.clickedAutoHide == true {
-                    self?.groupDelegate?.componentGroupDidDismiss?(group: self)
-                    self?.removeGroupView()
+//                    self?.groupDelegate?.componentGroupDidDismiss?(group: self)
+//                    self?.removeGroupView()
+                    
+                    self?.leftMouseDownAction()
+                    
+                    if let superGroupView = self?.superGroupView {
+                        superGroupView.leftMouseDownAction()
+                    }
                 }
                 self?.groupDelegate?.componentGroupDidSelect?(group: self, menuItemProperty: property)
             }

+ 3 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -6474,18 +6474,21 @@ extension KMMainViewController: ComponentGroupDelegate {
             if let sideVC = sideBarController {
                 kmPDFSideBarControllerDidSidebarTypeUpdated(sideVC)
             }
+            botaViewController?.chooseAIFunctionWithType(.reWriting)
         } else if (menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_AIProofread) {
             viewManager.pdfSideBarType = .aiTools
             sideBarController?.reloadData()
             if let sideVC = sideBarController {
                 kmPDFSideBarControllerDidSidebarTypeUpdated(sideVC)
             }
+            botaViewController?.chooseAIFunctionWithType(.proofreading)
         } else if (menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_AITranslate) {
             viewManager.pdfSideBarType = .aiTools
             sideBarController?.reloadData()
             if let sideVC = sideBarController {
                 kmPDFSideBarControllerDidSidebarTypeUpdated(sideVC)
             }
+            botaViewController?.chooseAIFunctionWithType(.translate)
         } else if (menuItemProperty?.identifier == PDFViewMenuIdentifier_Normal_Past) {
             let theEvent = menuItemProperty?.representedObject
             

+ 6 - 0
PDF Office/PDF Master/KMClass/Left/KMNLeftSideViewController.swift

@@ -225,6 +225,12 @@ class KMNLeftSideViewController: KMNBaseViewController {
             thumnailViewController?.selectionIndexPaths =  indexpaths
         }
     }
+    
+    public func chooseAIFunctionWithType(_ aiConfigType: AIConfigType) -> Void {
+        if self.leftsideType == .aiTools {
+            aiInfoViewController.chooseAIFunctionWithType(aiConfigType)
+        }
+    }
 }
 
 // MARK: - KMNThumbnailBaseViewDelegate

+ 1 - 1
PDF Office/PDF Master/KMClass/Settings/SettingsManager.swift

@@ -332,7 +332,7 @@ var autoScrollJumpSpaceKey  = "autoScrollJumpSpaceKey"
     }
     
     func resetPageDisplayData() {
-        self.layoutType = .singlePage
+        self.layoutType = .singlePageContinue
         self.zoomType = .adaptationWidth
         self.leftPanelType = .defaultOpen
         self.defaultOpen = .thumbnail