diff --git a/src/app/chat/views/message_format.nim b/src/app/chat/views/message_format.nim index 2999340a19..5bc063166a 100644 --- a/src/app/chat/views/message_format.nim +++ b/src/app/chat/views/message_format.nim @@ -1,3 +1,5 @@ +import sequtils + proc sectionIdentifier(message: Message): string = result = message.fromAuthor # Force section change, because group status messages are sent with the @@ -15,16 +17,15 @@ proc mention(self: ChatMessageList, pubKey: string): string = proc renderInline(self: ChatMessageList, elem: TextItem): string = case elem.textType: of "": result = elem.literal - of "code": result = fmt("{elem.literal} ") - of "emph": result = fmt("{elem.literal} ") - of "strong": result = fmt("{elem.literal} ") + of "code": result = fmt("{elem.literal.strip} ") + of "emph": result = fmt("{elem.literal} ") + of "strong": result = fmt("{elem.literal} ") of "link": result = elem.destination - of "mention": result = fmt("{self.mention(elem.literal)} ") + of "mention": result = fmt("{self.mention(elem.literal)} ") of "status-tag": result = fmt("{elem.literal} ") # See render-block in status-react/src/status_im/ui/screens/chat/message/message.cljs proc renderBlock(self: ChatMessageList, message: Message): string = - # TODO: find out how to extract the css styles for pMsg in message.parsedText: case pMsg.textType: of "paragraph": @@ -33,9 +34,8 @@ proc renderBlock(self: ChatMessageList, message: Message): string = result = result & self.renderInline(children) result = result & "

" of "blockquote": - # TODO: extract this from the theme somehow - var color = if message.isCurrentUser: "#FFFFFF" else: "#666666" - result = result & fmt("▍ ") & pMsg.literal & "" + result = result & pMsg.literal.strip.split("\n").mapIt("▍ " & it & "").join("
") of "codeblock": - result = result & "
" & pMsg.literal & "
" - result = result.replace("\n", "
") \ No newline at end of file + result = result & "" & pMsg.literal.strip & "" + result = result.strip() + diff --git a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml index e5af8f2009..7e40805996 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/Message.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/Message.qml @@ -366,10 +366,39 @@ Item { textFormat: TextEdit.RichText text: { if(contentType === Constants.stickerType) return ""; + let msg = linkify(message); if(isEmoji){ - return Emoji.parse(linkify(message), "72x72"); + return Emoji.parse(msg, "72x72"); } else { - return Emoji.parse(linkify(message), "26x26"); + return ` + + + + + ${Emoji.parse(msg, "26x26")} + + `; } }