fix label overriding itself
This commit is contained in:
parent
9f038467a9
commit
cb8ad83149
@ -247,10 +247,11 @@ public typealias ActionBlock = () -> Void
|
|||||||
case "action":
|
case "action":
|
||||||
guard let actionLabel = label as? Label else { continue }
|
guard let actionLabel = label as? Label else { continue }
|
||||||
|
|
||||||
actionLabel.addTappableLinkAttribute(range: range,
|
actionLabel.addDefaultAttributes(range: range, string: attributedString)
|
||||||
actionMap: json,
|
actionLabel.clauses.append(ActionableClause(range: range,
|
||||||
additionalData: additionalData,
|
actionBlock: actionLabel.createActionBlockFrom(actionMap: json,
|
||||||
delegateObject: delegate)
|
additionalData: additionalData,
|
||||||
|
delegateObject: delegate)))
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -397,6 +398,13 @@ extension Label {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addDefaultAttributes(range: NSRange, string: NSAttributedString?) {
|
||||||
|
|
||||||
|
guard let string = string else { return }
|
||||||
|
let mutableAttributedString = NSMutableAttributedString(attributedString: string)
|
||||||
|
mutableAttributedString.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range)
|
||||||
|
}
|
||||||
|
|
||||||
fileprivate func setDefaultAttributes(range: NSRange) {
|
fileprivate func setDefaultAttributes(range: NSRange) {
|
||||||
|
|
||||||
guard let attributedText = attributedText else { return }
|
guard let attributedText = attributedText else { return }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user