|
@@ -759,14 +759,17 @@ extension String {
|
|
|
}
|
|
|
}
|
|
|
if !isEditing {
|
|
|
- let listText = finalText.string.split(separator: " ")
|
|
|
- for i in 0...listText.count - 1 {
|
|
|
- if listText[i].lowercased().checkStartWithLink() {
|
|
|
- if ((listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 3) || (!listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 2)) && listText[i].lowercased().split(separator: ".").last!.count >= 2 {
|
|
|
- if let range: Range<String.Index> = finalText.string.range(of: listText[i]) {
|
|
|
- let index: Int = finalText.string.distance(from: finalText.string.startIndex, to: range.lowerBound)
|
|
|
- finalText.addAttribute(.foregroundColor, value: UIColor.linkColor, range: NSRange(index...index + listText[i].count - 1))
|
|
|
- finalText.addAttribute(.underlineStyle, value: NSUnderlineStyle.thick.rawValue, range: NSRange(index...index + listText[i].count - 1))
|
|
|
+ let listTextEnter = finalText.string.split(separator: "\n")
|
|
|
+ for j in 0...listTextEnter.count - 1 {
|
|
|
+ let listText = listTextEnter[j].split(separator: " ")
|
|
|
+ for i in 0...listText.count - 1 {
|
|
|
+ if listText[i].lowercased().checkStartWithLink() {
|
|
|
+ if ((listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 3) || (!listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 2)) && listText[i].lowercased().split(separator: ".").last!.count >= 2 {
|
|
|
+ if let range: Range<String.Index> = finalText.string.range(of: listText[i]) {
|
|
|
+ let index: Int = finalText.string.distance(from: finalText.string.startIndex, to: range.lowerBound)
|
|
|
+ finalText.addAttribute(.foregroundColor, value: UIColor.linkColor, range: NSRange(index...index + listText[i].count - 1))
|
|
|
+ finalText.addAttribute(.underlineStyle, value: NSUnderlineStyle.thick.rawValue, range: NSRange(index...index + listText[i].count - 1))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|