Change title edit control from TextEditor to TextField

This commit is contained in:
Angelo Stavrow 2020-09-21 16:02:43 -04:00
parent 0dbd47537c
commit 65edd393d3
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -9,9 +9,8 @@ struct PostEditorView: View {
VStack {
switch post.appearance {
case "sans":
TextEditor(text: $post.title)
TextField("", text: $post.title)
.font(.custom("OpenSans-Regular", size: 26, relativeTo: Font.TextStyle.largeTitle))
.frame(height: 100)
.onChange(of: post.title) { _ in
if post.status == PostStatus.published.rawValue {
post.status = PostStatus.edited.rawValue
@ -25,9 +24,8 @@ struct PostEditorView: View {
}
}
case "wrap", "mono", "code":
TextEditor(text: $post.title)
TextField("", text: $post.title)
.font(.custom("Hack", size: 26, relativeTo: Font.TextStyle.largeTitle))
.frame(height: 100)
.onChange(of: post.title) { _ in
if post.status == PostStatus.published.rawValue {
post.status = PostStatus.edited.rawValue
@ -41,9 +39,8 @@ struct PostEditorView: View {
}
}
default:
TextEditor(text: $post.title)
TextField("", text: $post.title)
.font(.custom("Lora", size: 26, relativeTo: Font.TextStyle.largeTitle))
.frame(height: 100)
.onChange(of: post.title) { _ in
if post.status == PostStatus.published.rawValue {
post.status = PostStatus.edited.rawValue