Skip to content

Get the insertion point location with onSelectionChange

Compare
Choose a tag to compare
@kyle-n kyle-n released this 08 Feb 21:16
· 9 commits to main since this release
710bb6f

This release adds a new modifier, onSelectionChange. Now whenever the insertion point changes in HighlightedTextEditor, it will run the provided callback.

HighlightedTextEditor(text: $text, highlightRules: .markdown)
    .onSelectionChange { (range: NSRange) in
        print(range)
    }

Thanks to @santi-g-s and @ben-ole for providing the inspiration and assistance for this feature.