Connector
final class Connector: Sendable
The observable Connector
class for the editor
-
The current
NSTextView
Declaration
Swift
var textView: TextView?
-
The optional current directive
Declaration
Swift
var currentDirective: ChordPro.Directive?
-
The current fragment of the cursor
Declaration
Swift
var currentFragment: NSTextLayoutFragment?
-
The optional clicked fragment in the editor
Declaration
Swift
var clickedFragment: NSTextLayoutFragment?
-
The settings for the editor
Declaration
Swift
var settings: ChordProEditor.Settings
-
The current font of the editor
Declaration
Swift
var font: NSFont
-
The selected ranges in the editor
Declaration
Swift
var selectedRanges: [NSValue] = []
-
The current state of selection
Declaration
Swift
var selectionState: ChordProEditor.SelectionState
-
Init the
Connector
classDeclaration
Swift
init(settings: ChordProEditor.Settings)
Parameters
settings
The settings for the editor
-
Set the text of the text view, replacing whole content
Declaration
Swift
public func setText(text: String)
Parameters
text
Te text
-
Insert text at the current range, removing any optional selected text
Declaration
Swift
public func insertText(text: String, range: NSRange? = nil)
Parameters
text
The text to insert
range
The optional range, or else the first selected range will be used
-
Wrap text selections
Note
Not used, I don’t know how to get multiple selections with TextKit 2Declaration
Swift
public func wrapTextSelections(leading: String, trailing: String)
Parameters
leading
The leading text
trailing
The trailing text
-
Highlight text containing chords or directives
See moreDeclaration
Swift
func processHighlighting(fullHighlight: Bool)
Parameters
fullHighlight
True if the full text must be checked, or else only the current paragraph