Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10433243
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
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
Details
Attached
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
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment