mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-27 13:59:04 -04:00
Format
This commit is contained in:
parent
8f3cd6f371
commit
21b33a1c76
@ -8,13 +8,12 @@
|
||||
import WebKit
|
||||
|
||||
final class BrowserUIDelegate: NSObject, WKUIDelegate {
|
||||
|
||||
@Published private(set) var externalURL: URL?
|
||||
|
||||
#if os(macOS)
|
||||
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration,
|
||||
for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
|
||||
|
||||
func webView(_: WKWebView, createWebViewWith _: WKWebViewConfiguration,
|
||||
for navigationAction: WKNavigationAction, windowFeatures _: WKWindowFeatures) -> WKWebView?
|
||||
{
|
||||
guard navigationAction.targetFrame == nil else { return nil }
|
||||
guard let newUrl = navigationAction.request.url else { return nil }
|
||||
|
||||
@ -42,14 +41,15 @@ final class BrowserUIDelegate: NSObject, WKUIDelegate {
|
||||
#if os(iOS)
|
||||
func webView(_ webView: WKWebView,
|
||||
contextMenuConfigurationForElement elementInfo: WKContextMenuElementInfo,
|
||||
completionHandler: @escaping (UIContextMenuConfiguration?) -> Void) {
|
||||
completionHandler: @escaping (UIContextMenuConfiguration?) -> Void)
|
||||
{
|
||||
guard let url = elementInfo.linkURL, url.isKiwixURL else { completionHandler(nil); return }
|
||||
let configuration = UIContextMenuConfiguration(
|
||||
previewProvider: {
|
||||
let webView = WKWebView(frame: .zero, configuration: WebViewConfiguration())
|
||||
webView.load(URLRequest(url: url))
|
||||
return WebViewController(webView: webView)
|
||||
}, actionProvider: { suggestedActions in
|
||||
}, actionProvider: { _ in
|
||||
var actions = [UIAction]()
|
||||
|
||||
// open url
|
||||
|
Loading…
x
Reference in New Issue
Block a user