File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 11import Foundation
22import 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+
414struct EditableText : View {
515 var text : Binding < String >
616 @State var isEditing : Bool = false
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments