mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Also fix pills with rich text editor
This commit is contained in:
parent
b72039e735
commit
320aae1430
@ -131,6 +131,7 @@ internal class EventEditor @Inject constructor(
|
||||
replyToEdit,
|
||||
originalTimelineEvent,
|
||||
newBodyText,
|
||||
newBodyFormattedText,
|
||||
true,
|
||||
MessageType.MSGTYPE_TEXT,
|
||||
compatibilityBodyText
|
||||
|
@ -312,7 +312,8 @@ internal class LocalEchoEventFactory @Inject constructor(
|
||||
roomId: String,
|
||||
eventReplaced: TimelineEvent,
|
||||
originalEvent: TimelineEvent,
|
||||
newBodyText: CharSequence,
|
||||
replyText: CharSequence,
|
||||
replyTextFormatted: String?,
|
||||
autoMarkdown: Boolean,
|
||||
msgType: String,
|
||||
compatibilityText: String,
|
||||
@ -321,22 +322,22 @@ internal class LocalEchoEventFactory @Inject constructor(
|
||||
val permalink = permalinkFactory.createPermalink(roomId, originalEvent.root.eventId ?: "", false)
|
||||
val userLink = originalEvent.root.senderId?.let { permalinkFactory.createPermalink(it, false) } ?: ""
|
||||
|
||||
val body = bodyForReply(timelineEvent = originalEvent)
|
||||
val bodyOfRepliedEvent = bodyForReply(timelineEvent = originalEvent)
|
||||
// As we always supply formatted body for replies we should force the MarkdownParser to produce html.
|
||||
val newBodyFormatted = markdownParser.parse(newBodyText, force = true, advanced = autoMarkdown).takeFormatted()
|
||||
val newBodyFormatted = replyTextFormatted ?: markdownParser.parse(replyText, force = true, advanced = autoMarkdown).takeFormatted()
|
||||
// Body of the original message may not have formatted version, so may also have to convert to html.
|
||||
val bodyFormatted = body.formattedText ?: markdownParser.parse(body.text, force = true, advanced = autoMarkdown).takeFormatted()
|
||||
val formattedBodyOfRepliedEvent = bodyOfRepliedEvent.formattedText ?: markdownParser.parse(bodyOfRepliedEvent.text, force = true, advanced = autoMarkdown).takeFormatted()
|
||||
val replyFormatted = buildFormattedReply(
|
||||
permalink,
|
||||
userLink,
|
||||
originalEvent.senderInfo.disambiguatedDisplayName,
|
||||
bodyFormatted,
|
||||
formattedBodyOfRepliedEvent,
|
||||
newBodyFormatted
|
||||
)
|
||||
//
|
||||
// > <@alice:example.org> This is the original body
|
||||
//
|
||||
val replyFallback = buildReplyFallback(body, originalEvent.root.senderId ?: "", newBodyText.toString())
|
||||
val replyFallback = buildReplyFallback(bodyOfRepliedEvent, originalEvent.root.senderId ?: "", replyText.toString())
|
||||
|
||||
return createMessageEvent(
|
||||
roomId,
|
||||
|
Loading…
Reference in New Issue
Block a user