diff --git a/src/components/views/rooms/EditMessageComposer.tsx b/src/components/views/rooms/EditMessageComposer.tsx index 36e2e5bf2d7..fc579634fce 100644 --- a/src/components/views/rooms/EditMessageComposer.tsx +++ b/src/components/views/rooms/EditMessageComposer.tsx @@ -48,25 +48,6 @@ import { withMatrixClientHOC, MatrixClientProps } from '../../../contexts/Matrix import RoomContext from '../../../contexts/RoomContext'; import { ComposerType } from "../../../dispatcher/payloads/ComposerInsertPayload"; -function getHtmlReplyFallback(mxEvent: MatrixEvent): string { - const html = mxEvent.getContent().formatted_body; - if (!html) { - return ""; - } - const rootNode = new DOMParser().parseFromString(html, "text/html").body; - const mxReply = rootNode.querySelector("mx-reply"); - return (mxReply && mxReply.outerHTML) || ""; -} - -function getTextReplyFallback(mxEvent: MatrixEvent): string { - const body = mxEvent.getContent().body; - const lines = body.split("\n").map(l => l.trim()); - if (lines.length > 2 && lines[0].startsWith("> ") && lines[1].length === 0) { - return `${lines[0]}\n\n`; - } - return ""; -} - function createEditContent( model: EditorModel, editedEvent: MatrixEvent, @@ -75,14 +56,6 @@ function createEditContent( if (isEmote) { model = stripEmoteCommand(model); } - const isReply = !!editedEvent.replyEventId; - let plainPrefix = ""; - let htmlPrefix = ""; - - if (isReply) { - plainPrefix = getTextReplyFallback(editedEvent); - htmlPrefix = getHtmlReplyFallback(editedEvent); - } const body = textSerialize(model); @@ -91,16 +64,16 @@ function createEditContent( "body": body, }; const contentBody: IContent = { - msgtype: newContent.msgtype, - body: `${plainPrefix} * ${body}`, + "msgtype": newContent.msgtype, + "body": body, }; - const formattedBody = htmlSerializeIfNeeded(model, { forceHTML: isReply }); + const formattedBody = htmlSerializeIfNeeded(model, { forceHTML: false }); if (formattedBody) { newContent.format = "org.matrix.custom.html"; newContent.formatted_body = formattedBody; contentBody.format = newContent.format; - contentBody.formatted_body = `${htmlPrefix} * ${formattedBody}`; + contentBody.formatted_body = formattedBody; } const relation = { diff --git a/src/components/views/rooms/SendMessageComposer.tsx b/src/components/views/rooms/SendMessageComposer.tsx index 54bc69cd24e..59dc7d45cc0 100644 --- a/src/components/views/rooms/SendMessageComposer.tsx +++ b/src/components/views/rooms/SendMessageComposer.tsx @@ -67,16 +67,6 @@ function addReplyToMessageContent( ): void { const replyContent = ReplyChain.makeReplyMixIn(replyToEvent); Object.assign(content, replyContent); - - // Part of Replies fallback support - prepend the text we're sending - // with the text we're replying to - const nestedReply = ReplyChain.getNestedReplyText(replyToEvent, permalinkCreator); - if (nestedReply) { - if (content.formatted_body) { - content.formatted_body = nestedReply.html + content.formatted_body; - } - content.body = nestedReply.body + content.body; - } } export function attachRelation( @@ -112,7 +102,8 @@ export function createMessageContent( msgtype: isEmote ? "m.emote" : "m.text", body: body, }; - const formattedBody = htmlSerializeIfNeeded(model, { forceHTML: !!replyToEvent }); + + const formattedBody = htmlSerializeIfNeeded(model, { forceHTML: false }); if (formattedBody) { content.format = "org.matrix.custom.html"; content.formatted_body = formattedBody;