瀏覽代碼

don't works HYPERLINK

marinofaggiana 4 年之前
父節點
當前提交
5abbc86b23
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      iOSClient/Viewer/NCViewerRichdocument.swift

+ 9 - 0
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -191,6 +191,15 @@ class NCViewerRichdocument: WKWebView, WKNavigationDelegate, WKScriptMessageHand
             if message.body as? String == "paste" {
                 self.paste(self)
             }
+            
+            if (message.body as? String)?.hasPrefix("HYPERLINK") != nil {
+                if let messageBodyItem = (message.body as? String)?.components(separatedBy: " ") {
+                    if messageBodyItem.count >= 2 {
+                        let url = URL(fileURLWithPath: messageBodyItem[1])
+                        UIApplication.shared.open(url, options: [:]) { (_) in }
+                    }
+                }
+            }
         }
     }