Skip to content

Commit 98b1bdc

Browse files
committed
fix: apply smart quotes setting to live editor
1 parent 624a3a1 commit 98b1bdc

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

‎EdgeMark/Core/Editor/MarkdownEditorView.swift‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ struct EdgeMarkImageProvider: EmbeddedImageProvider {
3232
/// Manages heading stripping, save debouncing, font observation, and the
3333
/// slash-command popup.
3434
struct MarkdownEditorView: View {
35+
private struct EditorRebuildIdentity: Hashable {
36+
let taskCheckboxPreset: String
37+
let spellChecking: Bool
38+
let grammarChecking: Bool
39+
let spellingCorrection: Bool
40+
let quoteSubstitution: Bool
41+
}
42+
3543
let noteID: UUID
3644
let noteTitle: String
3745
let noteFolder: String
@@ -157,10 +165,16 @@ struct MarkdownEditorView: View {
157165
Self.scrollOffsets[docId]
158166
},
159167
)
160-
// Force the text view to rebuild (makeNSView) when the task-checkbox style
161-
// changes — the engine's updateNSView doesn't sync taskCheckbox, so only a
162-
// full config re-application picks up the new SF Symbols.
163-
.id(appSettings.taskCheckboxPreset)
168+
// These configuration values are consulted when the native text view is
169+
// created but are not synchronized by the engine's updateNSView. Rebuild
170+
// only when one changes so Settings and AppKit menu toggles apply live.
171+
.id(EditorRebuildIdentity(
172+
taskCheckboxPreset: appSettings.taskCheckboxPreset.rawValue,
173+
spellChecking: appSettings.spellCheckingEnabled,
174+
grammarChecking: appSettings.grammarCheckingEnabled,
175+
spellingCorrection: appSettings.automaticSpellingCorrectionEnabled,
176+
quoteSubstitution: appSettings.automaticQuoteSubstitutionEnabled,
177+
))
164178
.onChange(of: text) { _, newText in
165179
slashHandler.contentDidSynchronize(newText)
166180
let heading = hiddenHeadingLine

0 commit comments

Comments
 (0)