forked from shadowfacts/Tusker
Prevent link activation when outside character
This commit is contained in:
parent
be81ffb61f
commit
ee20c95a5d
|
@ -197,7 +197,7 @@ class ContentTextView: LinkTextView {
|
|||
let locationInTextContainer = CGPoint(x: point.x - textContainerInset.left, y: point.y - textContainerInset.top)
|
||||
var partialFraction: CGFloat = 0
|
||||
let characterIndex = layoutManager.characterIndex(for: locationInTextContainer, in: textContainer, fractionOfDistanceBetweenInsertionPoints: &partialFraction)
|
||||
if characterIndex < textStorage.length {
|
||||
if characterIndex < textStorage.length && partialFraction < 1 {
|
||||
var range = NSRange()
|
||||
if let link = textStorage.attribute(.link, at: characterIndex, longestEffectiveRange: &range, in: textStorage.fullRange) as? URL {
|
||||
return (link, range)
|
||||
|
|
Loading…
Reference in New Issue