Set typingAttributes for Mac post editor

This commit is contained in:
Angelo Stavrow 2021-02-02 10:06:53 -05:00
parent 26ea1d97d2
commit ad78389dc3
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -140,8 +140,8 @@ final class CustomTextView: NSView {
layoutManager.addTextContainer(textContainer) layoutManager.addTextContainer(textContainer)
let paragraphStyle = NSMutableParagraphStyle() let paragraphStyle = NSMutableParagraphStyle()
let lineHeightMultiple: CGFloat = 1.5 let lineSpacing: CGFloat = 8.5
paragraphStyle.lineHeightMultiple = lineHeightMultiple paragraphStyle.lineSpacing = lineSpacing
let textView = NSTextView(frame: .zero, textContainer: textContainer) let textView = NSTextView(frame: .zero, textContainer: textContainer)
textView.autoresizingMask = .width textView.autoresizingMask = .width
@ -162,6 +162,7 @@ final class CustomTextView: NSView {
textView.usesFindPanel = true textView.usesFindPanel = true
textView.isAutomaticDashSubstitutionEnabled = false textView.isAutomaticDashSubstitutionEnabled = false
textView.isRichText = false textView.isRichText = false
textView.typingAttributes = [.paragraphStyle: paragraphStyle, .font: font] // H/T Daniel Jalkut
return textView return textView
}() }()