Python SwiftUI:如何禁用;“聪明的报价”;在文本编辑器中
我正在使用SwiftUI为MacOS开发一个基于Python的图形计算器 我正在使用SwiftUI的TextEditor作为Python代码的编辑器,但我不知道如何禁用智能引用(uitePuttraits,smartQuotesType:UITextSmartQuotesType)Python SwiftUI:如何禁用;“聪明的报价”;在文本编辑器中,python,matplotlib,swiftui,uitextinputtraits,Python,Matplotlib,Swiftui,Uitextinputtraits,我正在使用SwiftUI为MacOS开发一个基于Python的图形计算器 我正在使用SwiftUI的TextEditor作为Python代码的编辑器,但我不知道如何禁用智能引用(uitePuttraits,smartQuotesType:UITextSmartQuotesType) 经过几次试验,我提出了以下解决办法。它依赖于TextEditor是在NSTextView之上实现的这一事实,并在整个应用程序中更改其行为。这是丑陋的,但工作 // HACK to work-around the s
经过几次试验,我提出了以下解决办法。它依赖于TextEditor是在NSTextView之上实现的这一事实,并在整个应用程序中更改其行为。这是丑陋的,但工作
// HACK to work-around the smart quote issue
extension NSTextView {
open override var frame: CGRect {
didSet {
self.isAutomaticQuoteSubstitutionEnabled = false
}
}
}
// HACK to work-around the smart quote issue
extension NSTextView {
open override var frame: CGRect {
didSet {
self.isAutomaticQuoteSubstitutionEnabled = false
}
}
}