Skip to content

Commit

Permalink
Added helper function to get textRange from provide NSRange in Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdeep committed Oct 10, 2023
1 parent c6a49a7 commit 30c5d88
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Proton/Sources/Swift/Editor/EditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,13 @@ open class EditorView: UIView {
return richTextView.becomeFirstResponder()
}

/// Converts given range to `UITextRange`, if valid
/// - Parameter range: Range to convert
/// - Returns: `UITextRange` representation of provided NSRange, if valid.
public func textRange(from range: NSRange) -> UITextRange? {
range.toTextRange(textInput: richTextView)
}

/// The range of currently marked text in a document.
/// If there is no marked text, the value of the property is `nil`. Marked text is provisionally inserted text that requires user confirmation; it occurs in multistage text input. The current selection, which can be a caret or an extended range, always occurs within the marked text.
public var markedRange: NSRange? {
Expand Down

0 comments on commit 30c5d88

Please sign in to comment.