mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Render pills in RTE (#1874)
* for now this can only work locally * works * added a test * updated RTE * revert package * pr suggestion * reverting package versions * better naming
This commit is contained in:
@@ -220,15 +220,15 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private func addAllUsersMention(_ attributedString: NSMutableAttributedString) {
|
||||
func addAllUsersMention(_ attributedString: NSMutableAttributedString) {
|
||||
MatrixEntityRegex.allUsersRegex.matches(in: attributedString.string, options: []).forEach { match in
|
||||
if attributedString.attribute(.link, at: 0, longestEffectiveRange: nil, in: match.range) == nil {
|
||||
if attributedString.attribute(.link, at: 0, longestEffectiveRange: nil, in: match.range) as? URL == nil {
|
||||
attributedString.addAttribute(.MatrixAllUsersMention, value: true, range: match.range)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func detectPermalinks(_ attributedString: NSMutableAttributedString) {
|
||||
func detectPermalinks(_ attributedString: NSMutableAttributedString) {
|
||||
attributedString.enumerateAttribute(.link, in: .init(location: 0, length: attributedString.length), options: []) { value, range, _ in
|
||||
if value != nil {
|
||||
if let url = value as? URL {
|
||||
|
||||
Reference in New Issue
Block a user