Browse Source

【2025】【Layout】分享功能补充

niehaoyu 18 hours ago
parent
commit
01fd1d4d4b

+ 1 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownTool.swift

@@ -211,6 +211,7 @@ public class ComponentDropdownTool: ComponentBaseXibView {
             } else if item.type == .divider {
                 viewHeight += 8
             }
+            item.itemSelected = false
         }
         
         var point = convert(contendBox.frame.origin, to: window?.contentView)

+ 4 - 1
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Dropdown/ComponentDropdownTool/ComponentDropdownToolProperty.swift

@@ -18,6 +18,7 @@ public class ComponentDropdownToolProperty: NSObject {
     public var leftIcon: NSImage? //左侧icon
     public var isDisabled: Bool = false //禁用状态
     public var arrowIcon: NSImage?
+    public var identifier: String = ""
     
     public var propertyInfo = DropDownPropertyInfo()
     
@@ -28,7 +29,8 @@ public class ComponentDropdownToolProperty: NSObject {
                 disabled: Bool = false,
                 leftIcon: NSImage? = nil,
                 showDropdown: Bool = false,
-                arrowIcon: NSImage? = nil) {
+                arrowIcon: NSImage? = nil,
+                identifier: String = "") {
         
         self.state = state
         self.text = text
@@ -36,6 +38,7 @@ public class ComponentDropdownToolProperty: NSObject {
         self.leftIcon = leftIcon
         self.showDropdown = showDropdown
         self.arrowIcon = arrowIcon
+        self.identifier = identifier
         
     }
 }

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

@@ -1950,214 +1950,6 @@ extension KMMainViewController {
         }
     }
     
-    @objc private func shareDocument(sender:KMToolbarViewController, limit: Bool = false) {
-        if (limit) {
-            let document = self.listView.document ?? CPDFDocument()
-            if  document?.documentURL == nil {
-                return
-            }
-            var doucumentURL : URL = self.listView.document.documentURL
-            if doucumentURL.path.count > 0 {
-                let docDir = NSTemporaryDirectory()
-                let documentName : String = doucumentURL.path.lastPathComponent
-                let path = docDir.stringByAppendingPathComponent(documentName)
-                let data = KMTools.saveWatermarkDocument(document: self.listView.document, to: URL(fileURLWithPath: path), secureOptions: self.secureOptions, removePWD: self.removeSecureFlag)
-                let writeSuccess = data != nil
-                if writeSuccess == false {
-                    __NSBeep()
-                    return;
-                }
-                doucumentURL = URL(fileURLWithPath: path)
-            }
-            let array = [doucumentURL]
-            let picker = NSSharingServicePicker.init(items: array)
-            if sender.shareButton.window != nil {
-                picker.show(relativeTo: sender.shareButton.bounds, of: sender.shareButton, preferredEdge: NSRectEdge.minY)
-            } else {
-                picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
-            }
-            
-            return
-        }
-        
-        
-        let document = self.listView.document ?? CPDFDocument()
-        if  document?.documentURL == nil {
-            return
-        }
-        var doucumentURL : URL = self.listView.document.documentURL
-        if doucumentURL.path.count > 0 {
-            let docDir = NSTemporaryDirectory()
-            let documentName : String = doucumentURL.path.lastPathComponent
-            let path = docDir.stringByAppendingPathComponent(documentName)
-            let writeSuccess = self.listView.document.write(to: URL(fileURLWithPath: path))
-            if writeSuccess == false {
-                __NSBeep()
-                return;
-            }
-            doucumentURL = URL(fileURLWithPath: path)
-        }
-        let array = [doucumentURL]
-        let picker = NSSharingServicePicker.init(items: array)
-        if sender.shareButton.window != nil {
-            picker.show(relativeTo: sender.shareButton.bounds, of: sender.shareButton, preferredEdge: NSRectEdge.minY)
-        } else {
-            picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
-        }
-    }
-    
-    @objc private func shareFlatten(sender:KMToolbarViewController, limit: Bool = false) {
-        if (limit) {
-            let document = self.listView.document ?? CPDFDocument()
-            var path: String?
-            if  document?.documentURL != nil {
-                path = document?.documentURL.path ?? ""
-            }
-            if path?.count ?? 0 > 0 {
-                let docDir = NSTemporaryDirectory()
-                let documentName : String = path?.lastPathComponent ?? ""
-                path = docDir.stringByAppendingPathComponent(documentName)
-            }
-            let pathFolder = path?.fileURL.deletingLastPathComponent().path
-            var tfileName = path?.deletingPathExtension.lastPathComponent
-            let tStdFileSuffix = "_flatten"
-            tfileName = (tfileName ?? "") + tStdFileSuffix + ".pdf"
-            path = (pathFolder ?? "") + "/" + (tfileName ?? "")
-            
-            let data = KMTools.saveWatermarkDocumentForFlatten(document: document!, to: URL(fileURLWithPath: path ?? ""))
-            let success = data != nil
-            if success {
-                let url = URL(fileURLWithPath: path ?? "")
-                let picker = NSSharingServicePicker.init(items: [url])
-                if sender.shareButton.window != nil {
-                    picker.show(relativeTo: sender.shareButton.bounds, of: sender.shareButton, preferredEdge: NSRectEdge.minY)
-                } else {
-                    picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
-                }
-            }
-            return
-        }
-        
-        let document = self.listView.document ?? CPDFDocument()
-        var path: String?
-        if  document?.documentURL != nil {
-            path = document?.documentURL.path ?? ""
-        }
-        if path?.count ?? 0 > 0 {
-            let docDir = NSTemporaryDirectory()
-            let documentName : String = path?.lastPathComponent ?? ""
-            path = docDir.stringByAppendingPathComponent(documentName)
-        }
-        let pathFolder = path?.fileURL.deletingLastPathComponent().path
-        var tfileName = path?.deletingPathExtension.lastPathComponent
-        let tStdFileSuffix = "_flatten"
-        tfileName = (tfileName ?? "") + tStdFileSuffix + ".pdf"
-        path = (pathFolder ?? "") + "/" + (tfileName ?? "")
-        let success : Bool = document?.writeFlatten(to: URL(fileURLWithPath: path ?? "")) ?? false
-        if success {
-            let url = URL(fileURLWithPath: path ?? "")
-            let picker = NSSharingServicePicker.init(items: [url])
-            if sender.shareButton.window != nil {
-                picker.show(relativeTo: sender.shareButton.bounds, of: sender.shareButton, preferredEdge: NSRectEdge.minY)
-            } else {
-                picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
-            }
-        }
-    }
-    @objc private func shareOriginalPDF(sender:KMToolbarViewController, limit: Bool = false) {
-        guard let pdfDoc = self.listView.document else {
-            NSSound.beep()
-            return
-        }
-        if !pdfDoc.allowsCopying || !pdfDoc.allowsPrinting {
-            let alert = NSAlert()
-            alert.alertStyle = .critical
-            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
-            alert.runModal()
-            return
-        }
-        
-        if (limit) {
-            let document = self.listView.document ?? CPDFDocument()
-            var path: String?
-            if  document?.documentURL != nil {
-                path = document?.documentURL.path ?? ""
-            }
-            if path?.count ?? 0 > 0{
-                let docDir = NSTemporaryDirectory()
-                let documentName : String = path?.lastPathComponent ?? ""
-                path = docDir.stringByAppendingPathComponent(documentName)
-            }
-            let data = KMTools.saveWatermarkDocument(document: document!, to: URL(fileURLWithPath: path ?? ""), secureOptions: self.secureOptions, removePWD: self.removeSecureFlag)
-            var writeSuccess = data != nil
-            if writeSuccess == false {
-                __NSBeep()
-                return;
-            }
-            let newDocument = CPDFDocument(url: URL(fileURLWithPath: path ?? ""))
-            let cnt = newDocument?.pageCount ?? 0
-            for i in 0 ..< cnt {
-                let page = newDocument?.page(at: i)
-                var annotations : [CPDFAnnotation] = []
-                for annotation in page!.annotations {
-                    annotations.append(annotation)
-                }
-                for annotation in annotations {
-                    annotation.page.removeAnnotation(annotation)
-                }
-            }
-            writeSuccess = newDocument?.write(to:URL(fileURLWithPath: path ?? "")) ?? false
-            if writeSuccess {
-                let url = URL(fileURLWithPath: path ?? "")
-                let picker = NSSharingServicePicker.init(items: [url])
-                if sender.shareButton.window != nil {
-                    picker.show(relativeTo: sender.shareButton.bounds, of: sender.shareButton, preferredEdge: NSRectEdge.minY)
-                } else {
-                    picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
-                }
-            }
-            return
-        }
-        
-        let document = self.listView.document ?? CPDFDocument()
-        var path: String?
-        if  document?.documentURL != nil {
-            path = document?.documentURL.path ?? ""
-        }
-        if path?.count ?? 0 > 0 {
-            let docDir = NSTemporaryDirectory()
-            let documentName : String = path?.lastPathComponent ?? ""
-            path = docDir.stringByAppendingPathComponent(documentName)
-        }
-        var writeSuccess = document?.write(to: URL(fileURLWithPath: path ?? ""))
-        if writeSuccess == false {
-            __NSBeep()
-            return;
-        }
-        let newDocument = CPDFDocument(url: URL(fileURLWithPath: path ?? ""))
-        
-        let cnt = newDocument?.pageCount ?? 0
-        for i in 0 ..< cnt {
-            let page = newDocument!.page(at: i)
-            var annotations : [CPDFAnnotation] = []
-            for annotation in page!.annotations {
-                annotations.append(annotation)
-            }
-            for annotation in annotations {
-                annotation.page.removeAnnotation(annotation)
-            }
-        }
-        writeSuccess = newDocument?.write(to:URL(fileURLWithPath: path ?? ""))
-        if writeSuccess ?? false {
-            let url = URL(fileURLWithPath: path ?? "")
-            let picker = NSSharingServicePicker.init(items: [url])
-            if sender.shareButton.window != nil {
-                picker.show(relativeTo: sender.shareButton.bounds, of: sender.shareButton, preferredEdge: NSRectEdge.minY)
-            } else {
-                picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
-            }
-        }
-    }
     
     // 开启/关闭左边栏
     @objc func toggleLeftPane() -> Void {
@@ -3072,24 +2864,6 @@ extension KMMainViewController : KMToolbarViewControllerDelegate {
         self.trackEvent_share()
     }
     
-    func toolbarViewController(_ viewController: KMToolbarViewController, shareDocument item: NSMenuItem) {
-        self.shareDocument(sender: viewController)
-    }
-    
-    func toolbarViewController(_ viewController: KMToolbarViewController, shareFlatten item: NSMenuItem) {
-        if IAPProductsManager.default().isAvailableAllFunction() == false {
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_Flatten_BuyNow"
-            winC?.showWindow(nil)
-            return
-        }
-        self.shareFlatten(sender: viewController)
-    }
-    
-    func toolbarViewController(_ viewController: KMToolbarViewController, shareOriginalPDF item: NSMenuItem) {
-        self.shareOriginalPDF(sender: viewController)
-    }
-    
     func toolbarViewController(_ viewController: KMToolbarViewController, scanOCRModel selectedTag: Int) {
         if(0 == selectedTag) {
         } else {

+ 1 - 38
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -485,44 +485,7 @@ extension KMMainViewController {
         //增加判断,如果是正在滚动,就停止,否则就开始滚动
         self.listView.autoFlow()
     }
-    @objc func shareFromService(sender: NSMenuItem) {
-        if ((NSApp.mainWindow?.windowController is KMBrowserWindowController) == false) {
-            return
-        }
-        
-        var string = ""
-        if let freeTextAnnotation = listView.activeAnnotation as? CPDFFreeTextAnnotation {
-            string = freeTextAnnotation.contents ?? ""
-        } else if let markupAnnotation = listView.activeAnnotation as? CPDFMarkupAnnotation {
-            if let page = markupAnnotation.page {
-                if let selection = page.selection(for: markupAnnotation.bounds) {
-                    string = selection.string() ?? ""
-                }
-            }
-        } else {
-            string = listView.currentSelection?.string() ?? ""
-        }
-        
-        let windowControler = NSApp.mainWindow?.windowController as! KMBrowserWindowController
-        let model = windowControler.browser?.tabStripModel
-        if let cnt = model?.count(), cnt <= 0 {
-            return
-        }
-        
-        if let data = model?.activeTabContents().isHome, data {
-            return
-        }
-        
-        let document: KMMainDocument = model?.activeTabContents() as! KMMainDocument
-        if string.count > 0 {
-            let represent : NSSharingService = sender.representedObject as! NSSharingService
-            represent.perform(withItems: [string])
-            return
-        }
-
-        let represent = sender.representedObject as? NSSharingService
-        represent?.perform(withItems: [string])
-    }
+    
     
     @objc func cutAction(sender: NSMenuItem) {
         

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

@@ -1178,6 +1178,153 @@ import KMComponentLibrary
         
     }
     
+    //MARK: - Share
+    @objc private func shareDocument(sender: NSView) {
+        let document = self.listView.document ?? CPDFDocument()
+        if  document?.documentURL == nil {
+            return
+        }
+        var doucumentURL : URL = self.listView.document.documentURL
+        if doucumentURL.path.count > 0 {
+            let docDir = NSTemporaryDirectory()
+            let documentName : String = doucumentURL.path.lastPathComponent
+            let path = docDir.stringByAppendingPathComponent(documentName)
+            let writeSuccess = self.listView.document.write(to: URL(fileURLWithPath: path))
+            if writeSuccess == false {
+                __NSBeep()
+                return;
+            }
+            doucumentURL = URL(fileURLWithPath: path)
+        }
+        let array = [doucumentURL]
+        let picker = NSSharingServicePicker.init(items: array)
+        if sender.window != nil {
+            picker.show(relativeTo: sender.bounds, of: sender, preferredEdge: NSRectEdge.minY)
+        } else {
+            picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
+        }
+    }
+    
+    @objc private func shareFlatten(sender: NSView) {
+        let document = self.listView.document ?? CPDFDocument()
+        var path: String?
+        if  document?.documentURL != nil {
+            path = document?.documentURL.path ?? ""
+        }
+        if path?.count ?? 0 > 0 {
+            let docDir = NSTemporaryDirectory()
+            let documentName : String = path?.lastPathComponent ?? ""
+            path = docDir.stringByAppendingPathComponent(documentName)
+        }
+        let pathFolder = path?.fileURL.deletingLastPathComponent().path
+        var tfileName = path?.deletingPathExtension.lastPathComponent
+        let tStdFileSuffix = "_flatten"
+        tfileName = (tfileName ?? "") + tStdFileSuffix + ".pdf"
+        path = (pathFolder ?? "") + "/" + (tfileName ?? "")
+        let success : Bool = document?.writeFlatten(to: URL(fileURLWithPath: path ?? "")) ?? false
+        if success {
+            let url = URL(fileURLWithPath: path ?? "")
+            let picker = NSSharingServicePicker.init(items: [url])
+            if sender.window != nil {
+                picker.show(relativeTo: sender.bounds, of: sender, preferredEdge: NSRectEdge.minY)
+            } else {
+                picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
+            }
+        }
+    }
+    
+    @objc private func shareOriginalPDF(sender: NSView) {
+        guard let pdfDoc = self.listView.document else {
+            NSSound.beep()
+            return
+        }
+        if !pdfDoc.allowsCopying || !pdfDoc.allowsPrinting {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+            alert.runModal()
+            return
+        }
+        
+        let document = self.listView.document ?? CPDFDocument()
+        var path: String?
+        if  document?.documentURL != nil {
+            path = document?.documentURL.path ?? ""
+        }
+        if path?.count ?? 0 > 0 {
+            let docDir = NSTemporaryDirectory()
+            let documentName : String = path?.lastPathComponent ?? ""
+            path = docDir.stringByAppendingPathComponent(documentName)
+        }
+        var writeSuccess = document?.write(to: URL(fileURLWithPath: path ?? ""))
+        if writeSuccess == false {
+            __NSBeep()
+            return;
+        }
+        let newDocument = CPDFDocument(url: URL(fileURLWithPath: path ?? ""))
+        
+        let cnt = newDocument?.pageCount ?? 0
+        for i in 0 ..< cnt {
+            let page = newDocument!.page(at: i)
+            var annotations : [CPDFAnnotation] = []
+            for annotation in page!.annotations {
+                annotations.append(annotation)
+            }
+            for annotation in annotations {
+                annotation.page.removeAnnotation(annotation)
+            }
+        }
+        writeSuccess = newDocument?.write(to:URL(fileURLWithPath: path ?? ""))
+        if writeSuccess ?? false {
+            let url = URL(fileURLWithPath: path ?? "")
+            let picker = NSSharingServicePicker.init(items: [url])
+            if sender.window != nil {
+                picker.show(relativeTo: sender.bounds, of: sender, preferredEdge: NSRectEdge.minY)
+            } else {
+                picker.show(relativeTo: NSRect(x: (self.view.window?.contentView?.frame.size.width)!, y: (self.view.window?.contentView?.frame.size.height ?? 0)-8, width: 0, height: 0), of: self.view.window?.contentView ?? NSView(), preferredEdge: NSRectEdge.minY)
+            }
+        }
+    }
+    
+    @objc func shareFromService(sender: NSMenuItem) {
+        if ((NSApp.mainWindow?.windowController is KMBrowserWindowController) == false) {
+            return
+        }
+        
+        var string = ""
+        if let freeTextAnnotation = listView.activeAnnotation as? CPDFFreeTextAnnotation {
+            string = freeTextAnnotation.contents ?? ""
+        } else if let markupAnnotation = listView.activeAnnotation as? CPDFMarkupAnnotation {
+            if let page = markupAnnotation.page {
+                if let selection = page.selection(for: markupAnnotation.bounds) {
+                    string = selection.string() ?? ""
+                }
+            }
+        } else {
+            string = listView.currentSelection?.string() ?? ""
+        }
+        
+        let windowControler = NSApp.mainWindow?.windowController as! KMBrowserWindowController
+        let model = windowControler.browser?.tabStripModel
+        if let cnt = model?.count(), cnt <= 0 {
+            return
+        }
+        
+        if let data = model?.activeTabContents().isHome, data {
+            return
+        }
+        
+        let document: KMMainDocument = model?.activeTabContents() as! KMMainDocument
+        if string.count > 0 {
+            let represent : NSSharingService = sender.representedObject as! NSSharingService
+            represent.perform(withItems: [string])
+            return
+        }
+
+        let represent = sender.representedObject as? NSSharingService
+        represent?.perform(withItems: [string])
+    }
+    
 }
 
 //MARK: - NSSplitViewDelegate
@@ -1462,6 +1609,18 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
             listView.undoManager?.undo()
         } else if(itemIdentifier == KMPDFToolbar_redo_Identifier) {
             listView.undoManager?.redo()
+        } else if(itemIdentifier == KMPDFToolbar_share_PDF_Identifier) {
+            if let view = controller.findViewWith(KMPDFToolbar_share_Identifier) {
+                shareDocument(sender: view)
+            }
+        } else if(itemIdentifier == KMPDFToolbar_share_Flattened_Identifier) {
+            if let view = controller.findViewWith(KMPDFToolbar_share_Identifier) {
+                shareFlatten(sender: view)
+            }
+        } else if(itemIdentifier == KMPDFToolbar_share_Original_Identifier) {
+            if let view = controller.findViewWith(KMPDFToolbar_share_Identifier) {
+                shareOriginalPDF(sender: view)
+            }
         } else {
             print("click else")
         }

+ 35 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/Toolbar/KMPDFToolbarController.swift

@@ -486,6 +486,37 @@ class KMPDFToolbarController: NSViewController {
         }
     }
     
+    //MARK: - 查找
+    func findViewWith(_ identify: String) -> NSView? {
+
+        //左侧
+        
+        //中间
+        
+        //右侧
+        if true {
+            let views = rightToolsView.subviews
+            for view in views {
+                if view is ComponentButton {
+                    if (view as! ComponentButton).properties.identifier == identify {
+                        return view
+                    }
+                } else if view is ComponentDropdownTool {
+                    if (view as! ComponentDropdownTool).properties.identifier == identify {
+                        return view
+                    }
+                    for item in (view as! ComponentDropdownTool).properties.menuItemArr ?? [] {
+                        if item.identifier == identify {
+                            return view
+                        }
+                    }
+                }
+            }
+        }
+        
+        return nil
+    }
+    
     //MARK: - reloadData
     func reloadData() {
         reloadLeftIconView()
@@ -737,6 +768,10 @@ extension KMPDFToolbarController: ComponentDropdownToolDelegate {
             viewManager.viewToolsType = .Magnify
         } else if menuItem == toolbarManager.tools_areaProperty {
             viewManager.viewToolsType = .AreaZoom
+        } else if menuItem == toolbarManager.share_PDF_Property ||
+                    menuItem == toolbarManager.share_Flatted_Property ||
+                    menuItem == toolbarManager.share_Original_Property {
+            delegate?.kmPDFToolbarControllerDidToolbarItemClicked?(self, menuItem?.identifier ?? "")
         }
         reloadToolsView()
     }

+ 1 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/Toolbar/Model/KMPDFToolbarConfig.swift

@@ -76,6 +76,7 @@ let KMPDFToolbar_tts_Identifier                    = "KMPDFToolbar_tts_Identifie
 let KMPDFToolbar_ppt_Identifier                    = "KMPDFToolbar_ppt_Identifier"
 let KMPDFToolbar_print_Identifier                  = "KMPDFToolbar_print_Identifier"
 
+let KMPDFToolbar_share_Identifier                  = "KMPDFToolbar_share_Identifier"
 let KMPDFToolbar_share_PDF_Identifier              = "KMPDFToolbar_share_PDF_Identifier"
 let KMPDFToolbar_share_Flattened_Identifier        = "KMPDFToolbar_share_Flattened_Identifier"
 let KMPDFToolbar_share_Original_Identifier         = "KMPDFToolbar_share_Original_Identifier"

+ 1 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/Toolbar/Model/KMPDFToolbarManager.swift

@@ -77,7 +77,7 @@ class KMPDFToolbarManager: NSObject {
     var pptProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_ppt"), keepPressState: false,identifier: KMPDFToolbar_ppt_Identifier)
     var printProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_print"), keepPressState: false, identifier: KMPDFToolbar_print_Identifier)
     
-    var shareProperty: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, leftIcon: NSImage(named: "toolbar_share"))
+    var shareProperty: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, leftIcon: NSImage(named: "toolbar_share"), identifier: KMPDFToolbar_share_Identifier)
     var share_PDF_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("PDF"), identifier: KMPDFToolbar_share_PDF_Identifier)
     var share_Flatted_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Flattened Copy"), identifier: KMPDFToolbar_share_Flattened_Identifier)
     var share_Original_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Original PDF"), identifier: KMPDFToolbar_share_Original_Identifier)