Page MenuHomeMusing Studio

No OneTemporary

diff --git a/Shared/Post/PostEditor.swift b/Shared/Post/PostEditor.swift
index 5a06101..777bfb4 100644
--- a/Shared/Post/PostEditor.swift
+++ b/Shared/Post/PostEditor.swift
@@ -1,42 +1,40 @@
import SwiftUI
struct PostEditor: View {
@ObservedObject var post: Post
@State private var hasUnpublishedChanges: Bool = false
var body: some View {
VStack {
TextEditor(text: $post.title)
- .border(Color.blue, width: 1)
.font(.title)
.frame(height: 100)
.onChange(of: post.title) { _ in
if post.status == .published {
hasUnpublishedChanges = true
}
}
TextEditor(text: $post.body)
- .border(Color.red, width: 1)
.font(.body)
.onChange(of: post.body) { _ in
if post.status == .published {
hasUnpublishedChanges = true
}
}
}
.padding()
.toolbar {
if hasUnpublishedChanges {
PostStatusBadge(postStatus: .edited)
} else {
PostStatusBadge(postStatus: post.status)
}
}
}
}
struct PostEditor_Previews: PreviewProvider {
static var previews: some View {
PostEditor(post: testPost)
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jan 20, 2:11 AM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3137504

Event Timeline