88import Cocoa
99import WebKit
1010
11- class AboutWindowController : NSWindowController {
11+ class AboutWindowController : NSWindowController , WKNavigationDelegate {
1212
1313 @IBOutlet weak var appName : NSTextField !
1414 @IBOutlet weak var appVersion : NSTextField !
@@ -30,6 +30,8 @@ class AboutWindowController: NSWindowController {
3030
3131 creditsView. setValue ( false , forKey: " drawsBackground " )
3232
33+ vfxView. wantsLayer = true
34+ vfxView. layer? . cornerRadius = 4
3335
3436 // fill up labels
3537
@@ -38,7 +40,7 @@ class AboutWindowController: NSWindowController {
3840 let shortVersionString = Bundle . main. object ( forInfoDictionaryKey: " CFBundleShortVersionString " ) as! String
3941 let fullVersionString = Bundle . main. object ( forInfoDictionaryKey: " GitVersion " ) as! String
4042
41- appVersion. stringValue = String . localizedStringWithFormat ( NSLocalizedString ( " Version %@ (%@) " , comment: " Version string " ) , shortVersionString, fullVersionString) ;
43+ appVersion. stringValue = String . localizedStringWithFormat ( NSLocalizedString ( " Version %@ (%@) " , comment: " Version string " ) , shortVersionString, fullVersionString) ;
4244
4345 appCopyright. stringValue = Bundle . main. object ( forInfoDictionaryKey: " NSHumanReadableCopyright " ) as! String
4446
@@ -48,7 +50,22 @@ class AboutWindowController: NSWindowController {
4850 creditsView. loadHTMLString ( String ( data: data, encoding: . utf8) ?? " Could not load credits. " , baseURL: nil )
4951
5052 }
53+
54+ creditsView. navigationDelegate = self
5155
5256 }
5357
58+ func webView( _ webView: WKWebView , decidePolicyFor navigationAction: WKNavigationAction , decisionHandler: @escaping ( WKNavigationActionPolicy ) -> Void ) {
59+ if navigationAction. navigationType == . linkActivated,
60+ let url = navigationAction. request. url {
61+ NSWorkspace . shared. open ( url)
62+ decisionHandler ( . cancel)
63+ return
64+ }
65+ decisionHandler ( . allow)
66+ }
67+
68+ @objc func cancel( _ sender: Any ? ) {
69+ close ( )
70+ }
5471}
0 commit comments