From d129c0d0f93c6a7476edc5ec541b14a395e90b16 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Fri, 30 Oct 2020 16:28:34 -0400 Subject: [PATCH] Save/clear last draft based on status when loading post in editor --- iOS/PostEditor/PostEditorView.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iOS/PostEditor/PostEditorView.swift b/iOS/PostEditor/PostEditorView.swift index b369ba9..954798d 100644 --- a/iOS/PostEditor/PostEditorView.swift +++ b/iOS/PostEditor/PostEditorView.swift @@ -137,6 +137,11 @@ struct PostEditorView: View { }) .onAppear(perform: { 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: { if post.title.count == 0