Merge pull request #168 from writeas/mac-editor-qol-fixes

Add editing menu, enable find/replace, ignore formatted text on paste
This commit is contained in:
Angelo Stavrow 2021-02-01 11:07:22 -05:00 committed by GitHub
commit 26ea1d97d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -94,6 +94,8 @@ struct WriteFreely_MultiPlatformApp: App {
#endif #endif
} }
} }
ToolbarCommands()
TextEditingCommands()
} }
#if os(macOS) #if os(macOS)

View File

@ -140,7 +140,8 @@ final class CustomTextView: NSView {
layoutManager.addTextContainer(textContainer) layoutManager.addTextContainer(textContainer)
let paragraphStyle = NSMutableParagraphStyle() let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 8.5 let lineHeightMultiple: CGFloat = 1.5
paragraphStyle.lineHeightMultiple = lineHeightMultiple
let textView = NSTextView(frame: .zero, textContainer: textContainer) let textView = NSTextView(frame: .zero, textContainer: textContainer)
textView.autoresizingMask = .width textView.autoresizingMask = .width
@ -158,6 +159,9 @@ final class CustomTextView: NSView {
textView.minSize = NSSize(width: 0, height: contentSize.height) textView.minSize = NSSize(width: 0, height: contentSize.height)
textView.textColor = NSColor.labelColor textView.textColor = NSColor.labelColor
textView.allowsUndo = true textView.allowsUndo = true
textView.usesFindPanel = true
textView.isAutomaticDashSubstitutionEnabled = false
textView.isRichText = false
return textView return textView
}() }()