@@ -51,9 +51,9 @@ class EditTextView: NSTextView, NSTextFinderClient {
51
51
override func becomeFirstResponder( ) -> Bool {
52
52
let shouldBecomeFirstResponder = super. becomeFirstResponder ( )
53
53
if shouldBecomeFirstResponder && string. isEmpty {
54
- DispatchQueue . main . async {
55
- self . applyParagraphStyle ( )
56
- }
54
+ let paragraphStyle = NSTextStorage . getParagraphStyle ( )
55
+ typingAttributes [ . paragraphStyle ] = paragraphStyle
56
+ defaultParagraphStyle = paragraphStyle
57
57
}
58
58
59
59
return shouldBecomeFirstResponder
@@ -63,7 +63,6 @@ class EditTextView: NSTextView, NSTextFinderClient {
63
63
super. updateInsertionPointStateAndRestartTimer ( true )
64
64
if let range = selectedRanges [ 0 ] as? NSRange , range. length > 0 , range != initRange {
65
65
DispatchQueue . main. async {
66
- self . textStorage? . updateParagraphStyle ( )
67
66
self . initRange = range
68
67
}
69
68
}
@@ -99,7 +98,6 @@ class EditTextView: NSTextView, NSTextFinderClient {
99
98
100
99
if initRange. length > 0 {
101
100
DispatchQueue . main. async {
102
- self . textStorage? . updateParagraphStyle ( )
103
101
self . initRange = NSRange ( location: 0 , length: 0 )
104
102
}
105
103
}
@@ -239,7 +237,6 @@ class EditTextView: NSTextView, NSTextFinderClient {
239
237
breakUndoCoalescing ( )
240
238
saveTextStorageContent ( to: note)
241
239
fillHighlightLinks ( )
242
- textStorage? . updateParagraphStyle ( )
243
240
return
244
241
}
245
242
@@ -397,8 +394,8 @@ class EditTextView: NSTextView, NSTextFinderClient {
397
394
398
395
undoManager? . removeAllActions ( withTarget: self )
399
396
400
- if let appd = NSApplication . shared. delegate as? AppDelegate ,
401
- let md = appd . mainWindowController {
397
+ if let appDelegate = NSApplication . shared. delegate as? AppDelegate ,
398
+ let md = appDelegate . mainWindowController {
402
399
md. editorUndoManager = note. undoManager
403
400
}
404
401
@@ -800,7 +797,6 @@ class EditTextView: NSTextView, NSTextFinderClient {
800
797
NotesTextProcessor . highlightMarkdown ( attributedString: storage, note: note)
801
798
saveTextStorageContent ( to: note)
802
799
note. save ( )
803
- textStorage? . updateParagraphStyle ( )
804
800
}
805
801
viewDelegate? . notesTableView. reloadRow ( note: note)
806
802
@@ -992,13 +988,6 @@ class EditTextView: NSTextView, NSTextFinderClient {
992
988
NSWorkspace . shared. open ( url)
993
989
}
994
990
995
- public func applyParagraphStyle( ) {
996
- let paragraphStyle = NSTextStorage . getParagraphStyle ( )
997
- typingAttributes [ . paragraphStyle] = paragraphStyle
998
- defaultParagraphStyle = paragraphStyle
999
- textStorage? . updateParagraphStyle ( )
1000
- }
1001
-
1002
991
override func viewDidChangeEffectiveAppearance( ) {
1003
992
guard let note = EditTextView . note else { return }
1004
993
guard let vc = ViewController . shared ( ) else { return }
0 commit comments