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,
|
replyToEdit,
|
||||||
originalTimelineEvent,
|
originalTimelineEvent,
|
||||||
newBodyText,
|
newBodyText,
|
||||||
|
newBodyFormattedText,
|
||||||
true,
|
true,
|
||||||
MessageType.MSGTYPE_TEXT,
|
MessageType.MSGTYPE_TEXT,
|
||||||
compatibilityBodyText
|
compatibilityBodyText
|
||||||
|
@ -312,7 +312,8 @@ internal class LocalEchoEventFactory @Inject constructor(
|
|||||||
roomId: String,
|
roomId: String,
|
||||||
eventReplaced: TimelineEvent,
|
eventReplaced: TimelineEvent,
|
||||||
originalEvent: TimelineEvent,
|
originalEvent: TimelineEvent,
|
||||||
newBodyText: CharSequence,
|
replyText: CharSequence,
|
||||||
|
replyTextFormatted: String?,
|
||||||
autoMarkdown: Boolean,
|
autoMarkdown: Boolean,
|
||||||
msgType: String,
|
msgType: String,
|
||||||
compatibilityText: String,
|
compatibilityText: String,
|
||||||
@ -321,22 +322,22 @@ internal class LocalEchoEventFactory @Inject constructor(
|
|||||||
val permalink = permalinkFactory.createPermalink(roomId, originalEvent.root.eventId ?: "", false)
|
val permalink = permalinkFactory.createPermalink(roomId, originalEvent.root.eventId ?: "", false)
|
||||||
val userLink = originalEvent.root.senderId?.let { permalinkFactory.createPermalink(it, 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.
|
// 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.
|
// 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(
|
val replyFormatted = buildFormattedReply(
|
||||||
permalink,
|
permalink,
|
||||||
userLink,
|
userLink,
|
||||||
originalEvent.senderInfo.disambiguatedDisplayName,
|
originalEvent.senderInfo.disambiguatedDisplayName,
|
||||||
bodyFormatted,
|
formattedBodyOfRepliedEvent,
|
||||||
newBodyFormatted
|
newBodyFormatted
|
||||||
)
|
)
|
||||||
//
|
//
|
||||||
// > <@alice:example.org> This is the original body
|
// > <@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(
|
return createMessageEvent(
|
||||||
roomId,
|
roomId,
|
||||||
|
Loading…
Reference in New Issue
Block a user