Fix the texteditor on the notebook view

This commit is contained in:
Jackson Harper
2023-06-14 21:41:01 +08:00
parent fc08a434e1
commit 2f35d20562

View File

@ -6,6 +6,12 @@ public struct HighlightAnnotationSheet: View {
@Binding var errorAlertMessage: String?
@Binding var showErrorAlertMessage: Bool
enum FocusField: Hashable {
case textEditor
}
@FocusState private var focusedField: FocusField?
let onSave: () -> Void
let onCancel: () -> Void
@ -25,30 +31,14 @@ public struct HighlightAnnotationSheet: View {
public var body: some View {
VStack {
// HStack {
// Button(LocalText.cancelGeneric, action: onCancel)
// Spacer()
// Text("Note").font(Font.system(size: 18, weight: .bold))
// Spacer()
// Button(LocalText.genericSave) {
// onSave()
// }
// }
// .foregroundColor(.appGrayTextContrast)
ScrollView {
TextEditor(text: $annotation)
.frame(height: 200)
#if os(iOS)
.introspectTextView {
$0.becomeFirstResponder()
}
#endif
}
Spacer()
TextEditor(text: $annotation)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.focused($focusedField, equals: .textEditor)
.padding(.horizontal)
.task {
focusedField = .textEditor
}
}
.padding()
.navigationTitle("Note")
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)