Skip to content

Commit e1656f0

Browse files
committed
feat: add smart quotes editor setting
1 parent aa991f0 commit e1656f0

8 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎EdgeMark/Core/Editor/MarkdownEditorView.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct MarkdownEditorView: View {
116116
continuousSpellChecking: appSettings.spellCheckingEnabled,
117117
grammarChecking: appSettings.grammarCheckingEnabled,
118118
automaticSpellingCorrection: appSettings.automaticSpellingCorrectionEnabled,
119+
automaticQuoteSubstitution: appSettings.automaticQuoteSubstitutionEnabled,
119120
)
120121

121122
return ZStack(alignment: .bottom) {
@@ -133,11 +134,12 @@ struct MarkdownEditorView: View {
133134
return (try? FileStorage.saveImage(data: data, ext: ext, forNote: note))?.embedMarkdown
134135
},
135136
onSpellCheckingPolicyChanged: { policy in
136-
// Persist context-menu spelling/grammar/autocorrect toggles back to settings
137+
// Persist context-menu spelling/grammar/autocorrect/quote toggles back to settings
137138
// so they survive note switches and app restarts.
138139
AppSettings.shared.spellCheckingEnabled = policy.continuousSpellChecking
139140
AppSettings.shared.grammarCheckingEnabled = policy.grammarChecking
140141
AppSettings.shared.automaticSpellingCorrectionEnabled = policy.automaticSpellingCorrection
142+
AppSettings.shared.automaticQuoteSubstitutionEnabled = policy.automaticQuoteSubstitution
141143
},
142144
onPersistScrollOffset: { docId, offset in
143145
Self.scrollOffsets[docId] = offset

‎EdgeMark/Core/Settings/AppSettings.swift‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ final class AppSettings {
226226
didSet { UserDefaults.standard.set(automaticSpellingCorrectionEnabled, forKey: "automaticSpellingCorrectionEnabled") }
227227
}
228228

229+
/// Mirrors `SpellCheckingPolicy.automaticQuoteSubstitution`.
230+
/// Default off — Markdown and LaTeX source should retain straight quotes.
231+
var automaticQuoteSubstitutionEnabled: Bool = false {
232+
didSet { UserDefaults.standard.set(automaticQuoteSubstitutionEnabled, forKey: "automaticQuoteSubstitutionEnabled") }
233+
}
234+
229235
// MARK: - Hover-to-peek
230236

231237
/// Discrete dwell options for hover-to-preview. Space-to-preview is
@@ -351,6 +357,9 @@ final class AppSettings {
351357
if let raw = UserDefaults.standard.object(forKey: "automaticSpellingCorrectionEnabled") as? Bool {
352358
automaticSpellingCorrectionEnabled = raw
353359
}
360+
if let raw = UserDefaults.standard.object(forKey: "automaticQuoteSubstitutionEnabled") as? Bool {
361+
automaticQuoteSubstitutionEnabled = raw
362+
}
354363
if let raw = UserDefaults.standard.object(forKey: "hoverPeekEnabled") as? Bool {
355364
hoverPeekEnabled = raw
356365
}

‎EdgeMark/Resources/Locales/de.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"settings.editor.spellChecking": "Rechtschreibung prüfen",
154154
"settings.editor.grammarChecking": "Grammatik prüfen",
155155
"settings.editor.autocorrect": "Rechtschreibung auto-korrigieren",
156+
"settings.editor.smartQuotes": "Intelligente Anführungszeichen",
156157
"settings.editor.hoverPeek": "Drüberfahren zum Vorschauen",
157158
"settings.editor.hoverDelay": "Hover-Verzögerung",
158159
"settings.editor.spacePreview": "Leertaste zum Vorschauen",

‎EdgeMark/Resources/Locales/en.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"settings.editor.spellChecking": "Check spelling",
154154
"settings.editor.grammarChecking": "Check grammar",
155155
"settings.editor.autocorrect": "Auto-correct spelling",
156+
"settings.editor.smartQuotes": "Smart quotes",
156157
"settings.editor.hoverPeek": "Hover to preview",
157158
"settings.editor.hoverDelay": "Hover delay",
158159
"settings.editor.spacePreview": "Space to preview",

‎EdgeMark/Resources/Locales/es.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"settings.editor.spellChecking": "Corrección ortográfica",
154154
"settings.editor.grammarChecking": "Corrección gramatical",
155155
"settings.editor.autocorrect": "Autocorrección ortográfica",
156+
"settings.editor.smartQuotes": "Comillas tipográficas",
156157
"settings.editor.hoverPeek": "Vista previa al pasar el cursor",
157158
"settings.editor.hoverDelay": "Retraso al pasar el cursor",
158159
"settings.editor.spacePreview": "Espacio para vista previa",

‎EdgeMark/Resources/Locales/hi.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"settings.editor.spellChecking": "स्पेलिंग जांचें",
154154
"settings.editor.grammarChecking": "व्याकरण जांचें",
155155
"settings.editor.autocorrect": "स्पेलिंग ऑटो-करेक्ट",
156+
"settings.editor.smartQuotes": "स्मार्ट उद्धरण चिह्न",
156157
"settings.editor.hoverPeek": "हॉवर करके पूर्वावलोकन",
157158
"settings.editor.hoverDelay": "हॉवर विलंब",
158159
"settings.editor.spacePreview": "स्पेस से पूर्वावलोकन",

‎EdgeMark/Resources/Locales/zh-Hans.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"settings.editor.spellChecking": "拼写检查",
154154
"settings.editor.grammarChecking": "语法检查",
155155
"settings.editor.autocorrect": "自动更正拼写",
156+
"settings.editor.smartQuotes": "智能引号",
156157
"settings.editor.hoverPeek": "悬停预览",
157158
"settings.editor.hoverDelay": "悬停延时",
158159
"settings.editor.spacePreview": "空格键预览",

‎EdgeMark/UI/Settings/GeneralSettingsTab.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ struct GeneralSettingsTab: View {
148148
Toggle(l10n["settings.editor.spellChecking"], isOn: $settings.spellCheckingEnabled)
149149
Toggle(l10n["settings.editor.grammarChecking"], isOn: $settings.grammarCheckingEnabled)
150150
Toggle(l10n["settings.editor.autocorrect"], isOn: $settings.automaticSpellingCorrectionEnabled)
151+
Toggle(l10n["settings.editor.smartQuotes"], isOn: $settings.automaticQuoteSubstitutionEnabled)
151152
Toggle(l10n["settings.editor.hoverPeek"], isOn: $settings.hoverPeekEnabled)
152153
Picker(l10n["settings.editor.hoverDelay"], selection: $settings.hoverPeekDelay) {
153154
ForEach(AppSettings.HoverPeekDelay.allCases, id: \.self) { delay in

0 commit comments

Comments
 (0)