mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Keep the original foreground color in the mention (#2015)
* keep the original foreground color in the mention * changelog
This commit is contained in:
@@ -22,6 +22,7 @@ struct MentionBuilder: MentionBuilderProtocol {
|
|||||||
let attributes = attributedString.attributes(at: 0, longestEffectiveRange: nil, in: range)
|
let attributes = attributedString.attributes(at: 0, longestEffectiveRange: nil, in: range)
|
||||||
let font = attributes[.font] as? UIFont ?? .preferredFont(forTextStyle: .body)
|
let font = attributes[.font] as? UIFont ?? .preferredFont(forTextStyle: .body)
|
||||||
let blockquote = attributes[.MatrixBlockquote]
|
let blockquote = attributes[.MatrixBlockquote]
|
||||||
|
let foregroundColor = attributes[.foregroundColor] as? UIColor ?? .compound.textPrimary
|
||||||
|
|
||||||
let attachmentData = PillTextAttachmentData(type: .user(userID: userID), font: font)
|
let attachmentData = PillTextAttachmentData(type: .user(userID: userID), font: font)
|
||||||
guard let attachment = PillTextAttachment(attachmentData: attachmentData) else {
|
guard let attachment = PillTextAttachment(attachmentData: attachmentData) else {
|
||||||
@@ -29,7 +30,7 @@ struct MentionBuilder: MentionBuilderProtocol {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var attachmentAttributes: [NSAttributedString.Key: Any] = [.link: url, .MatrixUserID: userID, .font: font]
|
var attachmentAttributes: [NSAttributedString.Key: Any] = [.link: url, .MatrixUserID: userID, .font: font, .foregroundColor: foregroundColor]
|
||||||
if let blockquote {
|
if let blockquote {
|
||||||
// mentions can be in blockquotes, so if the replaced string was in one, we keep the attribute
|
// mentions can be in blockquotes, so if the replaced string was in one, we keep the attribute
|
||||||
attachmentAttributes[.MatrixBlockquote] = blockquote
|
attachmentAttributes[.MatrixBlockquote] = blockquote
|
||||||
@@ -43,13 +44,14 @@ struct MentionBuilder: MentionBuilderProtocol {
|
|||||||
let attributes = attributedString.attributes(at: 0, longestEffectiveRange: nil, in: range)
|
let attributes = attributedString.attributes(at: 0, longestEffectiveRange: nil, in: range)
|
||||||
let font = attributes[.font] as? UIFont ?? .preferredFont(forTextStyle: .body)
|
let font = attributes[.font] as? UIFont ?? .preferredFont(forTextStyle: .body)
|
||||||
let blockquote = attributes[.MatrixBlockquote]
|
let blockquote = attributes[.MatrixBlockquote]
|
||||||
|
let foregroundColor = attributes[.foregroundColor] as? UIColor ?? .compound.textPrimary
|
||||||
|
|
||||||
let attachmentData = PillTextAttachmentData(type: .allUsers, font: font)
|
let attachmentData = PillTextAttachmentData(type: .allUsers, font: font)
|
||||||
guard let attachment = PillTextAttachment(attachmentData: attachmentData) else {
|
guard let attachment = PillTextAttachment(attachmentData: attachmentData) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var attachmentAttributes: [NSAttributedString.Key: Any] = [.font: font, .MatrixAllUsersMention: true]
|
var attachmentAttributes: [NSAttributedString.Key: Any] = [.font: font, .MatrixAllUsersMention: true, .foregroundColor: foregroundColor]
|
||||||
if let blockquote {
|
if let blockquote {
|
||||||
// mentions can be in blockquotes, so if the replaced string was in one, we keep the attribute
|
// mentions can be in blockquotes, so if the replaced string was in one, we keep the attribute
|
||||||
attachmentAttributes[.MatrixBlockquote] = blockquote
|
attachmentAttributes[.MatrixBlockquote] = blockquote
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Fixed a bug that made the RTE color change when using mentions in dark mode.
|
||||||
Reference in New Issue
Block a user