Skip to content

Commit 8cdfcb1

Browse files
committed
Disable smart dash and quote
1 parent 46a91ee commit 8cdfcb1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Core/Sources/HostApp/SharedComponents/EditableText.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import Foundation
22
import SwiftUI
33

4+
// Hack to disable smart quotes and dashes in TextEditor
5+
extension NSTextView {
6+
open override var frame: CGRect {
7+
didSet {
8+
self.isAutomaticQuoteSubstitutionEnabled = false
9+
self.isAutomaticDashSubstitutionEnabled = false
10+
}
11+
}
12+
}
13+
414
struct EditableText: View {
515
var text: Binding<String>
616
@State var isEditing: Bool = false

Core/Sources/SharedUIComponents/CustomTextEditor.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public struct CustomTextEditor: NSViewRepresentable {
3131
textView.font = font
3232
textView.allowsUndo = true
3333
textView.drawsBackground = false
34+
textView.isAutomaticQuoteSubstitutionEnabled = false
35+
textView.isAutomaticDashSubstitutionEnabled = false
36+
textView.isAutomaticTextReplacementEnabled = false
3437

3538
return context.coordinator.theTextView
3639
}

0 commit comments

Comments
 (0)