Adds back/forward buttons to page menu
This commit is contained in:
@@ -203,6 +203,7 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
|
||||
let label = documentControls.fontSizeAdjustView.labelView
|
||||
label.text = numberFormatter.string(for: tab.webView._viewScale)
|
||||
|
||||
// Font size adjust
|
||||
documentControls.fontSizeAdjustView.decreaseSizeButton.addAction(UIAction(handler: { [unowned self] sender in
|
||||
self.decreaseSize(sender)
|
||||
label.text = numberFormatter.string(for: tab.webView._viewScale)
|
||||
@@ -213,11 +214,31 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
|
||||
label.text = numberFormatter.string(for: tab.webView._viewScale)
|
||||
}), for: .touchUpInside)
|
||||
|
||||
// Find on page
|
||||
documentControls.findOnPageControlView.addAction(UIAction(handler: { [unowned self] _ in
|
||||
documentControls.dismiss(animated: true, completion: nil)
|
||||
browserView.setFindOnPageVisible(true, animated: true)
|
||||
}), for: .touchUpInside)
|
||||
|
||||
// Navigation controls
|
||||
documentControls.navigationControlView.backButton.isEnabled = webView.canGoBack
|
||||
documentControls.navigationControlView.backButton.addAction(UIAction() { [unowned self] _ in
|
||||
webView.goBack()
|
||||
}, for: .touchUpInside)
|
||||
|
||||
documentControls.observations.append(webView.observe(\.canGoBack, changeHandler: { (_, _) in
|
||||
documentControls.navigationControlView.backButton.isEnabled = webView.canGoBack
|
||||
}))
|
||||
|
||||
documentControls.navigationControlView.forwardButton.isEnabled = webView.canGoForward
|
||||
documentControls.navigationControlView.forwardButton.addAction(UIAction() { [unowned self] _ in
|
||||
webView.goForward()
|
||||
}, for: .touchUpInside)
|
||||
|
||||
documentControls.observations.append(webView.observe(\.canGoForward, changeHandler: { (_, _) in
|
||||
documentControls.navigationControlView.forwardButton.isEnabled = webView.canGoForward
|
||||
}))
|
||||
|
||||
present(documentControls, animated: true, completion: nil)
|
||||
}), for: .touchUpInside)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user