mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Save/clear last draft based on status when loading post in editor
This commit is contained in:
parent
4ef40453d5
commit
d129c0d0f9
@ -137,6 +137,11 @@ struct PostEditorView: View {
|
|||||||
})
|
})
|
||||||
.onAppear(perform: {
|
.onAppear(perform: {
|
||||||
self.selectedCollection = collections.first { $0.alias == post.collectionAlias }
|
self.selectedCollection = collections.first { $0.alias == post.collectionAlias }
|
||||||
|
if post.status != PostStatus.published.rawValue {
|
||||||
|
self.model.editor.saveLastDraft(post)
|
||||||
|
} else {
|
||||||
|
self.model.editor.clearLastDraft()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.onDisappear(perform: {
|
.onDisappear(perform: {
|
||||||
if post.title.count == 0
|
if post.title.count == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user