mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Save or clear last draft URL from based on change in post status
This commit is contained in:
parent
c1ed348c96
commit
d3e89e2a45
@ -136,6 +136,13 @@ struct PostEditorView: View {
|
||||
model.move(post: post, from: selectedCollection, to: newCollection)
|
||||
}
|
||||
})
|
||||
.onChange(of: post.status, perform: { value in
|
||||
if value != PostStatus.published.rawValue {
|
||||
self.model.editor.saveLastDraft(post)
|
||||
} else {
|
||||
self.model.editor.clearLastDraft()
|
||||
}
|
||||
})
|
||||
.onAppear(perform: {
|
||||
self.selectedCollection = collections.first { $0.alias == post.collectionAlias }
|
||||
if post.status != PostStatus.published.rawValue {
|
||||
|
Loading…
Reference in New Issue
Block a user