Browse Source

【注释】修复“Form按钮(带链接)点击跳转链接”

wanjun 10 months ago
parent
commit
fd1809340c

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

@@ -2449,6 +2449,17 @@ let LOCKED_KEY  = "locked"
     
     func pdfViewPerformURL(_ pdfView: CPDFView!, withContent content: String!) {
         KMPrint("pdfViewPerformURL")
+        if content != nil {
+            NSWorkspace.shared.open(URL(string: content)!)
+        } else {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.informativeText = NSLocalizedString("The hyperlink is invalid.", comment: "")
+            alert.messageText = ""
+            alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+            alert.runModal()
+            return
+        }
     }
     
     func pdfViewPerformPrint(_ pdfView: CPDFView!) {