name change
This commit is contained in:
parent
fe09ce04dc
commit
ab33ceebde
@ -247,7 +247,7 @@ public typealias ActionBlock = () -> Void
|
||||
case "action":
|
||||
guard let actionLabel = label as? Label else { continue }
|
||||
|
||||
actionLabel.addDefaultAttributes(range: range, string: attributedString)
|
||||
actionLabel.addActionAttributes(range: range, string: attributedString)
|
||||
actionLabel.clauses.append(ActionableClause(range: range,
|
||||
actionBlock: actionLabel.createActionBlockFrom(actionMap: json,
|
||||
additionalData: additionalData,
|
||||
@ -398,18 +398,18 @@ extension Label {
|
||||
}
|
||||
}
|
||||
|
||||
func addDefaultAttributes(range: NSRange, string: NSMutableAttributedString?) {
|
||||
func addActionAttributes(range: NSRange, string: NSMutableAttributedString?) {
|
||||
|
||||
guard let string = string else { return }
|
||||
string.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range)
|
||||
}
|
||||
|
||||
fileprivate func setDefaultAttributes(range: NSRange) {
|
||||
fileprivate func setActionAttributes(range: NSRange) {
|
||||
|
||||
guard let attributedText = attributedText else { return }
|
||||
|
||||
let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText)
|
||||
addDefaultAttributes(range: range, string: mutableAttributedString)
|
||||
addActionAttributes(range: range, string: mutableAttributedString)
|
||||
self.attributedText = mutableAttributedString
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ extension Label {
|
||||
*/
|
||||
@objc public func addTappableLinkAttribute(range: NSRange, actionBlock: @escaping ActionBlock) {
|
||||
|
||||
setDefaultAttributes(range: range)
|
||||
setActionAttributes(range: range)
|
||||
clauses.append(ActionableClause(range: range, actionBlock: actionBlock))
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ extension Label {
|
||||
*/
|
||||
@objc public func addTappableLinkAttribute(range: NSRange, actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
|
||||
|
||||
setDefaultAttributes(range: range)
|
||||
setActionAttributes(range: range)
|
||||
clauses.append(ActionableClause(range: range,
|
||||
actionBlock: createActionBlockFrom(actionMap: actionMap,
|
||||
additionalData: additionalData,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user