@@ -26,70 +26,28 @@ struct EditorScreen: View {
2626 headerContent
2727 } content : {
2828 if let note = noteStore . selectedNote {
29- ZStack ( alignment : . top ) {
30- MarkdownEditorView (
31- noteID : note . id ,
32- noteTitle : note . title ,
33- noteFolder : note . folder ,
34- initialContent : note . content ,
35- topOverlayInset : StickyNoteTitleBar . editorContentInset ,
36- onContentChanged : { id , newContent in
37- noteStore . updateContent ( for : id , content : newContent )
38- } ,
39- pendingReload : $pendingEditorReload ,
40- showFindBar : $isFindBarShowing ,
41- onNavigateNext : { noteStore . navigateToNextNote ( sortedBy : appSettings ) } ,
42- onNavigatePrevious : { noteStore . navigateToPreviousNote ( sortedBy : appSettings ) } ,
43- )
44- . onAppear {
45- noteStore . onNeedEditorReload = { content in
46- pendingEditorReload = content
47- }
29+ MarkdownEditorView (
30+ noteID : note . id ,
31+ noteTitle : note . title ,
32+ noteFolder : note . folder ,
33+ initialContent : note . content ,
34+ onContentChanged : { id , newContent in
35+ noteStore . updateContent ( for : id , content : newContent )
36+ } ,
37+ pendingReload : $pendingEditorReload ,
38+ showFindBar : $isFindBarShowing ,
39+ onNavigateNext : { noteStore . navigateToNextNote ( sortedBy : appSettings ) } ,
40+ onNavigatePrevious : { noteStore . navigateToPreviousNote ( sortedBy : appSettings ) } ,
41+ )
42+ . onAppear {
43+ noteStore . onNeedEditorReload = { content in
44+ pendingEditorReload = content
4845 }
49- . onChange ( of : noteStore . pendingEditorFind ) { _ , pending in
50- guard pending else { return }
51- noteStore . pendingEditorFind = false
52- isFindBarShowing = true
53- }
54-
55- StickyNoteTitleBar (
56- title : note . title . isEmpty ? l10n [ " common.untitled " ] : note . title ,
57- text : Binding (
58- get : {
59- noteRename . renamingNoteID == note . id
60- ? noteRename . text
61- : note . title
62- } ,
63- set : { newValue in
64- if noteRename . renamingNoteID != note . id {
65- noteRename . beginRename ( note )
66- }
67- noteRename . text = newValue
68- } ,
69- ) ,
70- isFocused : $isNoteTitleFocused ,
71- isEditing : noteRename . renamingNoteID == note . id ,
72- isConflicting : noteRename . isConflicting ( in : noteStore ) ,
73- onBeginEditing : {
74- if noteRename . renamingNoteID != note . id {
75- noteRename . beginRename ( note )
76- }
77- } ,
78- onCommit : {
79- noteRename . commit ( note : note , noteStore : noteStore )
80- if noteRename . renamingNoteID == nil {
81- isNoteTitleFocused = false
82- }
83- } ,
84- onCancel : {
85- noteRename . cancel ( noteStore : noteStore )
86- isNoteTitleFocused = false
87- } ,
88- onFocusLost : {
89- noteRename . commitOrCancel ( note : note , noteStore : noteStore )
90- } ,
91- )
92- . zIndex ( 1 )
46+ }
47+ . onChange ( of : noteStore . pendingEditorFind ) { _ , pending in
48+ guard pending else { return }
49+ noteStore . pendingEditorFind = false
50+ isFindBarShowing = true
9351 }
9452 }
9553 }
@@ -128,22 +86,54 @@ struct EditorScreen: View {
12886 private var headerContent : some View {
12987 if let note = noteStore . selectedNote {
13088 VStack ( spacing : 4 ) {
131- HStack {
89+ HStack ( spacing : 8 ) {
13290 HeaderIconButton (
13391 systemName : " chevron.left " ,
13492 help : backLabel ,
13593 ) {
13694 goBack ( )
13795 }
13896
139- Spacer ( )
140-
141- Text ( note . displayDirectory )
142- . font ( . caption )
143- . foregroundStyle ( . tertiary )
144- . lineLimit ( 1 )
145-
146- Spacer ( )
97+ NoteHeaderTitle (
98+ title : note . title . isEmpty ? l10n [ " common.untitled " ] : note . title ,
99+ path : note . displayPath ,
100+ modifiedAt : note . modifiedAt . homeDisplayFormat ,
101+ createdAt : note . createdAt . homeDisplayFormat ,
102+ text : Binding (
103+ get : {
104+ noteRename . renamingNoteID == note . id
105+ ? noteRename . text
106+ : note . title
107+ } ,
108+ set : { newValue in
109+ if noteRename . renamingNoteID != note . id {
110+ noteRename . beginRename ( note )
111+ }
112+ noteRename . text = newValue
113+ } ,
114+ ) ,
115+ isFocused : $isNoteTitleFocused ,
116+ isEditing : noteRename . renamingNoteID == note . id ,
117+ isConflicting : noteRename . isConflicting ( in : noteStore ) ,
118+ onBeginEditing : {
119+ if noteRename . renamingNoteID != note . id {
120+ noteRename . beginRename ( note )
121+ }
122+ } ,
123+ onCommit : {
124+ noteRename . commit ( note : note , noteStore : noteStore )
125+ if noteRename . renamingNoteID == nil {
126+ isNoteTitleFocused = false
127+ }
128+ } ,
129+ onCancel : {
130+ noteRename . cancel ( noteStore : noteStore )
131+ isNoteTitleFocused = false
132+ } ,
133+ onFocusLost : {
134+ noteRename . commitOrCancel ( note : note , noteStore : noteStore )
135+ } ,
136+ )
147137
148138 HStack ( spacing : SurfaceMetrics . controlGroupSpacing ) {
149139 PinButton ( )
@@ -158,18 +148,20 @@ struct EditorScreen: View {
158148 }
159149 }
160150
161- HStack ( spacing : 12 ) {
162- DateLabelView (
163- systemName : " clock " ,
164- date : note . modifiedAt . homeDisplayFormat ,
165- tooltip : L10n . shared . t ( " editor.modifiedAt " , note . modifiedAt . homeDisplayFormat ) ,
166- )
151+ if appSettings . showNoteDatesInHeader {
152+ HStack ( spacing : 12 ) {
153+ DateLabelView (
154+ systemName : " clock " ,
155+ date : note . modifiedAt . homeDisplayFormat ,
156+ tooltip : L10n . shared . t ( " editor.modifiedAt " , note . modifiedAt . homeDisplayFormat ) ,
157+ )
167158
168- DateLabelView (
169- systemName : " calendar " ,
170- date : note . createdAt . homeDisplayFormat ,
171- tooltip : L10n . shared . t ( " editor.createdAt " , note . createdAt . homeDisplayFormat ) ,
172- )
159+ DateLabelView (
160+ systemName : " calendar " ,
161+ date : note . createdAt . homeDisplayFormat ,
162+ tooltip : L10n . shared . t ( " editor.createdAt " , note . createdAt . homeDisplayFormat ) ,
163+ )
164+ }
173165 }
174166 }
175167 }
0 commit comments