home: disable context menu on Big Sur
Due to various SwiftUI issues that only occur on Big Sur, we will just disable the context menu to avoid showing broken UI. Users should use the toolbar for the same actions. Resolves #5147
This commit is contained in:
parent
c0e470df59
commit
c5bbf2e7eb
|
@ -24,6 +24,34 @@ struct VMContextMenuModifier: ViewModifier {
|
|||
@State private var shareItem: VMShareItemModifier.ShareItem?
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
#if os(macOS)
|
||||
if #unavailable(macOS 12) {
|
||||
bodyBigSur(content: content)
|
||||
} else {
|
||||
bodyFull(content: content)
|
||||
}
|
||||
#else
|
||||
return bodyFull(content: content)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
@ViewBuilder func bodyBigSur(content: Content) -> some View {
|
||||
content.contextMenu {
|
||||
Button {
|
||||
NSWorkspace.shared.activateFileViewerSelecting([vm.pathUrl])
|
||||
} label: {
|
||||
Label("Show in Finder", systemImage: "folder")
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Full context menu for anything other than Big Sur
|
||||
/// - Parameter content: Content
|
||||
/// - Returns: View
|
||||
@available(macOS 12, *)
|
||||
@ViewBuilder func bodyFull(content: Content) -> some View {
|
||||
content.contextMenu {
|
||||
#if os(macOS)
|
||||
Button {
|
||||
|
|
Loading…
Reference in New Issue