mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Improve message edit with RTE (#1742)
* Improv edit for RTE * Refine code block style in composer * Update matrix-wysiwyg-composer-swift to 2.13.0 * Remove workaround * Update ElementX/Sources/Services/Timeline/TimelineItems/Items/Messages/TextRoomTimelineItemContent.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * Refactor rawFormattedBody -> formattedBodyHTMLString --------- Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -141,8 +141,8 @@ private extension HTMLParserStyle {
|
||||
linkColor: UIColor.link,
|
||||
codeBlockStyle: BlockStyle(backgroundColor: UIColor(.compound._bgCodeBlock),
|
||||
borderColor: UIColor(.compound.borderInteractiveSecondary),
|
||||
borderWidth: 0.0,
|
||||
cornerRadius: 0.0,
|
||||
borderWidth: 1.0,
|
||||
cornerRadius: 2.0,
|
||||
padding: BlockStyle.Padding(horizontal: 10, vertical: 12),
|
||||
type: .background),
|
||||
quoteBlockStyle: BlockStyle(backgroundColor: UIColor(.compound.iconTertiary),
|
||||
|
||||
@@ -578,7 +578,19 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
return
|
||||
}
|
||||
|
||||
actionsSubject.send(.composer(action: .setText(text: messageTimelineItem.body)))
|
||||
let text: String
|
||||
switch messageTimelineItem.contentType {
|
||||
case .text(let textItem):
|
||||
if ServiceLocator.shared.settings.richTextEditorEnabled, let formattedBodyHTMLString = textItem.formattedBodyHTMLString {
|
||||
text = formattedBodyHTMLString
|
||||
} else {
|
||||
text = messageTimelineItem.body
|
||||
}
|
||||
default:
|
||||
text = messageTimelineItem.body
|
||||
}
|
||||
|
||||
actionsSubject.send(.composer(action: .setText(text: text)))
|
||||
actionsSubject.send(.composer(action: .setMode(mode: .edit(originalItemId: messageTimelineItem.id))))
|
||||
case .copyPermalink:
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user