Place the comment in the right place in DetailWebView.
This commit is contained in:
parent
bdf94c21f0
commit
2f8bee998e
|
@ -9,19 +9,17 @@
|
|||
import AppKit
|
||||
import WebKit
|
||||
|
||||
// There’s no API for affecting a WKWebView’s contextual menu.
|
||||
// (WebView had API for this.)
|
||||
//
|
||||
// This a minor hack. It hides unwanted menu items.
|
||||
// The menu item identifiers are not documented anywhere;
|
||||
// they could change, and this code would need updating.
|
||||
|
||||
final class DetailWebView: WKWebView {
|
||||
|
||||
// MARK: NSView
|
||||
|
||||
override func willOpenMenu(_ menu: NSMenu, with event: NSEvent) {
|
||||
|
||||
// There’s no API for affecting a WKWebView’s contextual menu.
|
||||
// (WebView had API for this.)
|
||||
//
|
||||
// This a minor hack. It hides unwanted menu items.
|
||||
// The menu item identifiers are not documented anywhere;
|
||||
// they could change, and this code would need updating.
|
||||
for menuItem in menu.items {
|
||||
if shouldHideMenuItem(menuItem) {
|
||||
menuItem.isHidden = true
|
||||
|
@ -47,6 +45,8 @@ final class DetailWebView: WKWebView {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension NSUserInterfaceItemIdentifier {
|
||||
|
||||
static let DetailMenuItemIdentifierReload = NSUserInterfaceItemIdentifier(rawValue: "WKMenuItemIdentifierReload")
|
||||
|
|
Loading…
Reference in New Issue