Add PostCommands menu to Mac app

This commit is contained in:
Angelo Stavrow 2020-12-16 11:35:40 -05:00
parent 09131d5873
commit 6164ceeb99
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
3 changed files with 24 additions and 0 deletions

View File

@ -55,6 +55,7 @@ struct WriteFreely_MultiPlatformApp: App {
.keyboardShortcut("r", modifiers: [.command])
}
SidebarCommands()
PostCommands(post: model.selectedPost)
CommandGroup(after: .help) {
Button("Visit Support Forum") {
#if os(macOS)

View File

@ -49,6 +49,7 @@
1765F62A24E18EA200C9EBF0 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1765F62924E18EA200C9EBF0 /* SidebarView.swift */; };
1765F62B24E18EA200C9EBF0 /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1765F62924E18EA200C9EBF0 /* SidebarView.swift */; };
17681E412519410E00D394AE /* UINavigationController+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17681E402519410E00D394AE /* UINavigationController+Appearance.swift */; };
1780F6EF25895EDB00FE45FF /* PostCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780F6EE25895EDB00FE45FF /* PostCommands.swift */; };
17A5388824DDA31F00DEFF9A /* MacAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388724DDA31F00DEFF9A /* MacAccountView.swift */; };
17A5388C24DDC83F00DEFF9A /* AccountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388B24DDC83F00DEFF9A /* AccountModel.swift */; };
17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17A5388D24DDEC7400DEFF9A /* AccountView.swift */; };
@ -141,6 +142,7 @@
1756DC0024FEE18400207AB8 /* WFACollection+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WFACollection+CoreDataProperties.swift"; sourceTree = SOURCE_ROOT; };
1765F62924E18EA200C9EBF0 /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
17681E402519410E00D394AE /* UINavigationController+Appearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Appearance.swift"; sourceTree = "<group>"; };
1780F6EE25895EDB00FE45FF /* PostCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostCommands.swift; sourceTree = "<group>"; };
17A5388724DDA31F00DEFF9A /* MacAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacAccountView.swift; sourceTree = "<group>"; };
17A5388B24DDC83F00DEFF9A /* AccountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountModel.swift; sourceTree = "<group>"; };
17A5388D24DDEC7400DEFF9A /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = "<group>"; };
@ -322,6 +324,7 @@
isa = PBXGroup;
children = (
17BC617825715068003363CA /* ActivePostToolbarView.swift */,
1780F6EE25895EDB00FE45FF /* PostCommands.swift */,
);
path = Navigation;
sourceTree = "<group>";
@ -777,6 +780,7 @@
1756DC0224FEE18400207AB8 /* WFACollection+CoreDataClass.swift in Sources */,
1756DBB424FECDBB00207AB8 /* PostEditorStatusToolbarView.swift in Sources */,
17A5388F24DDEC7400DEFF9A /* AccountView.swift in Sources */,
1780F6EF25895EDB00FE45FF /* PostCommands.swift in Sources */,
170DFA35251BBC44001D82A0 /* PostEditorModel.swift in Sources */,
1756AE7524CB26FA00FD7257 /* PostCellView.swift in Sources */,
17A5388824DDA31F00DEFF9A /* MacAccountView.swift in Sources */,

View File

@ -0,0 +1,19 @@
import SwiftUI
struct PostCommands: Commands {
@State var post: WFAPost?
var body: some Commands {
CommandMenu("Post") {
Button("Publish…") {
print("Published active post (not really): '\(post?.title ?? "untitled")'")
}
Button("Move…") {
print("Moved active post (not really): '\(post?.title ?? "untitled")'")
}
Button("Copy Link To Post") {
print("Copied URL to post (not really): '\(post?.title ?? "untitled")'")
}
}
}
}