mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Improve code blocks
This commit is contained in:
@@ -215,9 +215,11 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
|
||||
nsString = text as NSString
|
||||
}
|
||||
if let codeBlockTitleColor, let codeBlockAccentColor, let codeBlockBackgroundColor {
|
||||
string.addAttribute(NSAttributedString.Key(rawValue: "Attribute__Blockquote"), value: TextNodeBlockQuoteData(kind: .code(language: language), title: language.flatMap {
|
||||
NSAttributedString(string: $0.capitalized, font: boldFont.withSize(round(boldFont.pointSize * 0.8235294117647058)), textColor: codeBlockTitleColor)
|
||||
}, color: codeBlockAccentColor, secondaryColor: nil, tertiaryColor: nil, backgroundColor: codeBlockBackgroundColor), range: range)
|
||||
var title: NSAttributedString?
|
||||
if let language, !language.isEmpty {
|
||||
title = NSAttributedString(string: language.capitalized, font: boldFont.withSize(round(boldFont.pointSize * 0.8235294117647058)), textColor: codeBlockTitleColor)
|
||||
}
|
||||
string.addAttribute(NSAttributedString.Key(rawValue: "Attribute__Blockquote"), value: TextNodeBlockQuoteData(kind: .code(language: language), title: title, color: codeBlockAccentColor, secondaryColor: nil, tertiaryColor: nil, backgroundColor: codeBlockBackgroundColor), range: range)
|
||||
}
|
||||
case .BlockQuote:
|
||||
addFontAttributes(range, .blockQuote)
|
||||
|
||||
Reference in New Issue
Block a user