mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Add basic slash commands support to UserSuggestion module
This commit is contained in:
@@ -58,6 +58,22 @@ extension RoomViewController {
|
||||
}
|
||||
}
|
||||
|
||||
@objc func setCommand(_ command: String) {
|
||||
if let wysiwygInputToolbar, wysiwygInputToolbar.textFormattingEnabled {
|
||||
wysiwygInputToolbar.command(command)
|
||||
wysiwygInputToolbar.becomeFirstResponder()
|
||||
} else {
|
||||
guard let attributedText = inputToolbarView.attributedTextMessage else { return }
|
||||
|
||||
let newAttributedString = NSMutableAttributedString(attributedString: attributedText)
|
||||
newAttributedString.append(NSAttributedString(string: "\(command) ",
|
||||
attributes: [.font: inputToolbarView.defaultFont]))
|
||||
|
||||
inputToolbarView.attributedTextMessage = newAttributedString
|
||||
inputToolbarView.becomeFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Send the formatted text message and its raw counterpart to the room
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user