mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
fix
This commit is contained in:
parent
a484c283cb
commit
22479c53d6
1 changed files with 29 additions and 0 deletions
|
@ -51,6 +51,10 @@ class HTMLFormatter: NSObject {
|
|||
DTDefaultFontName: font.fontName,
|
||||
DTDefaultFontSize: font.pointSize,
|
||||
DTDefaultLinkDecoration: false,
|
||||
// This fixes the issue where links are displayed in black
|
||||
// However doesn't matter the value provided the color doesn't change
|
||||
// From the default accent one
|
||||
DTDefaultLinkColor: "",
|
||||
DTWillFlushBlockCallBack: sanitizeCallback
|
||||
]
|
||||
options.merge(extraOptions) { (_, new) in new }
|
||||
|
@ -63,6 +67,7 @@ class HTMLFormatter: NSObject {
|
|||
MXKTools.removeDTCoreTextArtifacts(mutableString)
|
||||
postFormatOperations?(mutableString)
|
||||
|
||||
|
||||
return mutableString
|
||||
}
|
||||
|
||||
|
@ -109,3 +114,27 @@ extension HTMLFormatter {
|
|||
return stringBuilder?.generatedAttributedString()
|
||||
}
|
||||
}
|
||||
|
||||
extension UIColor {
|
||||
func toHexString() -> String {
|
||||
var r:CGFloat = 0
|
||||
var g:CGFloat = 0
|
||||
var b:CGFloat = 0
|
||||
var a:CGFloat = 0
|
||||
|
||||
getRed(&r, green: &g, blue: &b, alpha: &a)
|
||||
|
||||
let rgb:Int = (Int)(r*255)<<16 | (Int)(g*255)<<8 | (Int)(b*255)<<0
|
||||
|
||||
return NSString(format:"#%06x", rgb) as String
|
||||
}
|
||||
|
||||
convenience init(red: Int, green: Int, blue: Int) {
|
||||
assert(red >= 0 && red <= 255, "Invalid red component")
|
||||
assert(green >= 0 && green <= 255, "Invalid green component")
|
||||
assert(blue >= 0 && blue <= 255, "Invalid blue component")
|
||||
|
||||
self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: 1.0)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue