diff --git a/Proton/Sources/Swift/Editor/EditorView.swift b/Proton/Sources/Swift/Editor/EditorView.swift index f5ef3470..ece1efbb 100644 --- a/Proton/Sources/Swift/Editor/EditorView.swift +++ b/Proton/Sources/Swift/Editor/EditorView.swift @@ -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? {