mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Merge pull request #107 from writeas/editor-design-improvements
Minor editor design improvements
This commit is contained in:
commit
d6a073ccd8
@ -1,6 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PostEditorView: View {
|
||||
private let bodyLineSpacing: CGFloat = 17 * 0.5
|
||||
@EnvironmentObject var model: WriteFreelyModel
|
||||
@Environment(\.managedObjectContext) var moc
|
||||
@Environment(\.horizontalSizeClass) var horizontalSizeClass
|
||||
@ -56,6 +57,7 @@ struct PostEditorView: View {
|
||||
switch post.appearance {
|
||||
case "sans":
|
||||
TextField("Title (optional)", text: $post.title)
|
||||
.padding(.horizontal, 4)
|
||||
.font(.custom("OpenSans-Regular", size: 26, relativeTo: Font.TextStyle.largeTitle))
|
||||
.onChange(of: post.title) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingTitleFromServer {
|
||||
@ -75,6 +77,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
TextEditor(text: $post.body)
|
||||
.font(.custom("OpenSans-Regular", size: 17, relativeTo: Font.TextStyle.body))
|
||||
.lineSpacing(bodyLineSpacing)
|
||||
.onChange(of: post.body) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingBodyFromServer {
|
||||
post.status = PostStatus.edited.rawValue
|
||||
@ -86,6 +89,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
case "wrap", "mono", "code":
|
||||
TextField("Title (optional)", text: $post.title)
|
||||
.padding(.horizontal, 4)
|
||||
.font(.custom("Hack", size: 26, relativeTo: Font.TextStyle.largeTitle))
|
||||
.onChange(of: post.title) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingTitleFromServer {
|
||||
@ -105,6 +109,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
TextEditor(text: $post.body)
|
||||
.font(.custom("Hack", size: 17, relativeTo: Font.TextStyle.body))
|
||||
.lineSpacing(bodyLineSpacing)
|
||||
.onChange(of: post.body) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingBodyFromServer {
|
||||
post.status = PostStatus.edited.rawValue
|
||||
@ -116,6 +121,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
default:
|
||||
TextField("Title (optional)", text: $post.title)
|
||||
.padding(.horizontal, 4)
|
||||
.font(.custom("Lora", size: 26, relativeTo: Font.TextStyle.largeTitle))
|
||||
.onChange(of: post.title) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingTitleFromServer {
|
||||
@ -135,6 +141,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
TextEditor(text: $post.body)
|
||||
.font(.custom("Lora", size: 17, relativeTo: Font.TextStyle.body))
|
||||
.lineSpacing(bodyLineSpacing)
|
||||
.onChange(of: post.body) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingBodyFromServer {
|
||||
post.status = PostStatus.edited.rawValue
|
||||
|
@ -1,6 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PostEditorView: View {
|
||||
private let bodyLineSpacing: CGFloat = 17 * 0.5
|
||||
@EnvironmentObject var model: WriteFreelyModel
|
||||
|
||||
@ObservedObject var post: WFAPost
|
||||
@ -14,6 +15,7 @@ struct PostEditorView: View {
|
||||
case "sans":
|
||||
TextField("Title (optional)", text: $post.title)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding(.horizontal, 4)
|
||||
.padding(.bottom)
|
||||
.font(.custom("OpenSans-Regular", size: 26, relativeTo: Font.TextStyle.largeTitle))
|
||||
.onChange(of: post.title) { _ in
|
||||
@ -34,6 +36,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
TextEditor(text: $post.body)
|
||||
.font(.custom("OpenSans-Regular", size: 17, relativeTo: Font.TextStyle.body))
|
||||
.lineSpacing(bodyLineSpacing)
|
||||
.opacity(post.body.count == 0 && !isHovering ? 0.0 : 1.0)
|
||||
.onChange(of: post.body) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingBodyFromServer {
|
||||
@ -51,6 +54,7 @@ struct PostEditorView: View {
|
||||
case "wrap", "mono", "code":
|
||||
TextField("Title (optional)", text: $post.title)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding(.horizontal, 4)
|
||||
.padding(.bottom)
|
||||
.font(.custom("Hack", size: 26, relativeTo: Font.TextStyle.largeTitle))
|
||||
.onChange(of: post.title) { _ in
|
||||
@ -71,6 +75,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
TextEditor(text: $post.body)
|
||||
.font(.custom("Hack", size: 17, relativeTo: Font.TextStyle.body))
|
||||
.lineSpacing(bodyLineSpacing)
|
||||
.opacity(post.body.count == 0 && !isHovering ? 0.0 : 1.0)
|
||||
.onChange(of: post.body) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingBodyFromServer {
|
||||
@ -88,6 +93,7 @@ struct PostEditorView: View {
|
||||
default:
|
||||
TextField("Title (optional)", text: $post.title)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding(.horizontal, 4)
|
||||
.padding(.bottom)
|
||||
.font(.custom("Lora", size: 26, relativeTo: Font.TextStyle.largeTitle))
|
||||
.onChange(of: post.title) { _ in
|
||||
@ -108,6 +114,7 @@ struct PostEditorView: View {
|
||||
}
|
||||
TextEditor(text: $post.body)
|
||||
.font(.custom("Lora", size: 17, relativeTo: Font.TextStyle.body))
|
||||
.lineSpacing(bodyLineSpacing)
|
||||
.opacity(post.body.count == 0 && !isHovering ? 0.0 : 1.0)
|
||||
.onChange(of: post.body) { _ in
|
||||
if post.status == PostStatus.published.rawValue && !updatingBodyFromServer {
|
||||
|
Loading…
Reference in New Issue
Block a user