File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ struct MarkdownEditorView: View {
5050 @ State private var saveDebouncer = Debouncer ( delay : 1.0 )
5151 @ State private var slashHandler = SlashCommandHandler ( )
5252 @ State private var noteNavMonitor : Any ?
53+
54+ /// Per-note scroll offsets persisted across editor unmount/remount (engine 0.12.0
55+ /// `onPersistScrollOffset` / `restoreScrollOffset`). Session-level — not persisted
56+ /// to disk (matches the engine's original coordinator-level offsets). Keyed by noteID.
57+ private static var scrollOffsets : [ String : CGFloat ] = [ : ]
5358 /// Latched at init — never updated on re-render. Guards against @Observable pushing
5459 /// a new selectedNote into the animating-out EditorScreen, which would overwrite
5560 /// onContentChanged's captured note ID while @State text still holds the old note's content.
@@ -130,6 +135,12 @@ struct MarkdownEditorView: View {
130135 AppSettings . shared . grammarCheckingEnabled = policy . grammarChecking
131136 AppSettings . shared . automaticSpellingCorrectionEnabled = policy . automaticSpellingCorrection
132137 } ,
138+ onPersistScrollOffset : { docId , offset in
139+ Self . scrollOffsets [ docId ] = offset
140+ } ,
141+ restoreScrollOffset : { docId in
142+ Self . scrollOffsets [ docId ]
143+ } ,
133144 )
134145 // Force the text view to rebuild (makeNSView) when the task-checkbox style
135146 // changes — the engine's updateNSView doesn't sync taskCheckbox, so only a
You can’t perform that action at this time.
0 commit comments