mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-18 11:05:41 +01:00
WKUIDelegate for file open panel
This commit is contained in:
parent
615e7583bb
commit
6fd71f9ebf
@ -190,6 +190,20 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
||||
}
|
||||
}
|
||||
|
||||
extension SafariExtensionViewController: WKUIDelegate {
|
||||
func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping ([URL]?) -> Void) {
|
||||
let openPanel = NSOpenPanel()
|
||||
openPanel.canChooseFiles = true
|
||||
openPanel.begin { result in
|
||||
if result == NSApplication.ModalResponse.OK && openPanel.url != nil {
|
||||
completionHandler([openPanel.url!])
|
||||
} else {
|
||||
completionHandler(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func processWindowsForTabs(wins: [SFSafariWindow], options: TabQueryOptions?, complete: @escaping ([Tab]) -> Void) {
|
||||
if wins.count == 0 {
|
||||
complete([])
|
||||
|
Loading…
Reference in New Issue
Block a user