mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Reverting RTE to use SDK markdown when in markdown mode (#2327)
This commit is contained in:
@@ -31,7 +31,7 @@ enum ComposerToolbarVoiceMessageAction {
|
||||
}
|
||||
|
||||
enum ComposerToolbarViewModelAction {
|
||||
case sendMessage(plain: String, html: String, mode: RoomScreenComposerMode, intentionalMentions: IntentionalMentions)
|
||||
case sendMessage(plain: String, html: String?, mode: RoomScreenComposerMode, intentionalMentions: IntentionalMentions)
|
||||
case attach(ComposerAttachmentType)
|
||||
|
||||
case handlePasteOrDrop(provider: NSItemProvider)
|
||||
|
||||
@@ -87,11 +87,15 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
appSettings.$richTextEditorEnabled
|
||||
.map { !$0 }
|
||||
.assign(to: &wysiwygViewModel.$plainTextMode)
|
||||
|
||||
completionSuggestionService.suggestionsPublisher
|
||||
.combineLatest(appSettings.$richTextEditorEnabled)
|
||||
.map { suggestions, richTextEditorEnabled in
|
||||
// We ignore user suggestions when RTE is disabled since mentions would not work
|
||||
guard richTextEditorEnabled else {
|
||||
return []
|
||||
}
|
||||
return suggestions
|
||||
}
|
||||
.weakAssign(to: \.state.suggestions, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -111,8 +115,9 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
case .previewVoiceMessage:
|
||||
actionsSubject.send(.voiceMessage(.send))
|
||||
default:
|
||||
let sendHTML = appSettings.richTextEditorEnabled
|
||||
actionsSubject.send(.sendMessage(plain: wysiwygViewModel.content.markdown,
|
||||
html: wysiwygViewModel.content.html,
|
||||
html: sendHTML ? wysiwygViewModel.content.html : nil,
|
||||
mode: state.composerMode,
|
||||
intentionalMentions: wysiwygViewModel
|
||||
.getMentionsState()
|
||||
|
||||
@@ -461,7 +461,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
state.showLoading = false
|
||||
}
|
||||
|
||||
private func sendCurrentMessage(_ message: String, html: String, mode: RoomScreenComposerMode, intentionalMentions: IntentionalMentions) async {
|
||||
private func sendCurrentMessage(_ message: String, html: String?, mode: RoomScreenComposerMode, intentionalMentions: IntentionalMentions) async {
|
||||
guard !message.isEmpty else {
|
||||
fatalError("This message should never be empty")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user