mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Resizable Composer With Completion Suggestion View (#1971)
* resizable composer with suggestions view * FF cleanup * removing the view when the vertical size is compact * merge conflict fix * done * solving a conflict * Update ElementX/Sources/Screens/ComposerToolbar/View/CompletionSuggestionView.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * pr suggestion --------- Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -18,15 +18,7 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
struct MentionBuilder: MentionBuilderProtocol {
|
||||
// Can be removed when mentions are enabled by default
|
||||
let mentionsEnabled: Bool
|
||||
|
||||
func handleUserMention(for attributedString: NSMutableAttributedString, in range: NSRange, url: URL, userID: String) {
|
||||
guard mentionsEnabled else {
|
||||
attributedString.addAttributes([.MatrixUserID: userID], range: range)
|
||||
return
|
||||
}
|
||||
|
||||
let attributes = attributedString.attributes(at: 0, longestEffectiveRange: nil, in: range)
|
||||
let font = attributes[.font] as? UIFont ?? .preferredFont(forTextStyle: .body)
|
||||
let blockquote = attributes[.MatrixBlockquote]
|
||||
@@ -48,10 +40,6 @@ struct MentionBuilder: MentionBuilderProtocol {
|
||||
}
|
||||
|
||||
func handleAllUsersMention(for attributedString: NSMutableAttributedString, in range: NSRange) {
|
||||
guard mentionsEnabled else {
|
||||
return
|
||||
}
|
||||
|
||||
let attributes = attributedString.attributes(at: 0, longestEffectiveRange: nil, in: range)
|
||||
let font = attributes[.font] as? UIFont ?? .preferredFont(forTextStyle: .body)
|
||||
let blockquote = attributes[.MatrixBlockquote]
|
||||
|
||||
@@ -177,7 +177,7 @@ struct MessageText_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
private static let htmlStringWithList = "<p>This is a list</p>\n<ul>\n<li>One</li>\n<li>Two</li>\n<li>And number 3</li>\n</ul>\n"
|
||||
|
||||
private static let attributedStringBuilder = AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL, mentionBuilder: MentionBuilder(mentionsEnabled: true))
|
||||
private static let attributedStringBuilder = AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL, mentionBuilder: MentionBuilder())
|
||||
|
||||
static var attachmentPreview: some View {
|
||||
MessageText(attributedString: attributedStringWithAttachment)
|
||||
|
||||
Reference in New Issue
Block a user