Skip to content

Commit d3e89e2

Browse files
committed
Save or clear last draft URL from based on change in post status
1 parent c1ed348 commit d3e89e2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

iOS/PostEditor/PostEditorView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ struct PostEditorView: View {
136136
model.move(post: post, from: selectedCollection, to: newCollection)
137137
}
138138
})
139+
.onChange(of: post.status, perform: { value in
140+
if value != PostStatus.published.rawValue {
141+
self.model.editor.saveLastDraft(post)
142+
} else {
143+
self.model.editor.clearLastDraft()
144+
}
145+
})
139146
.onAppear(perform: {
140147
self.selectedCollection = collections.first { $0.alias == post.collectionAlias }
141148
if post.status != PostStatus.published.rawValue {

0 commit comments

Comments
 (0)