diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml index 1e42a1906a..831e7d4e09 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatText.qml @@ -88,7 +88,7 @@ Item { return Emoji.parse(msg, Emoji.size.middle); } else { if(isEdited){ - let index = msg.length - 4 + let index = msg.endsWith("code>") ? msg.length : msg.length - 4 return Utils.getMessageWithStyle(Emoji.parse(msg.slice(0, index) + Constants.editLabel + msg.slice(index)), appSettings.useCompactMode, isCurrentUser, hoveredLink) } return Utils.getMessageWithStyle(Emoji.parse(msg), appSettings.useCompactMode, isCurrentUser, hoveredLink) diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml index 112f1980e0..aea2b4ced1 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/CompactMessage.qml @@ -209,6 +209,49 @@ Item { anchors.right: parent.right anchors.rightMargin: root.chatHorizontalPadding height: (item !== null && typeof(item)!== 'undefined')? item.height: 0 + property string sourceText + + onActiveChanged: { + if (!active) { + return + } + + let mentionsMap = new Map() + let index = 0 + while (true) { + index = message.indexOf("", index) + if (endIndex < 0) { + index += 8 // "" + mentionsMap.set(address, linkTag) + index += linkTag.length + } + + sourceText = plainText + for (let [key, value] of mentionsMap) { + sourceText = sourceText.replace(new RegExp(key, 'g'), value) + } + sourceText = sourceText.replace(/\n/g, "
") + sourceText = Utils.getMessageWithStyle(sourceText, appSettings.useCompactMode, isCurrentUser) + } + sourceComponent: Item { id: editText height: childrenRect.height @@ -223,11 +266,10 @@ Item { StatusChatInput { id: editTextInput - readonly property string originalText: Utils.getMessageWithStyle(Emoji.parse(message)) chatInputPlaceholder: qsTrId("type-a-message-") chatType: chatsModel.channelView.activeChannel.chatType isEdit: true - textInput.text: originalText + textInput.text: editMessageLoader.sourceText onSendMessage: { saveBtn.clicked() } diff --git a/ui/fonts/RobotoMono/RobotoMono-Regular.ttf b/ui/fonts/RobotoMono/RobotoMono-Regular.ttf new file mode 100644 index 0000000000..7c4ce36a44 Binary files /dev/null and b/ui/fonts/RobotoMono/RobotoMono-Regular.ttf differ diff --git a/ui/imports/Themes/DarkTheme.qml b/ui/imports/Themes/DarkTheme.qml index d0db17854b..589f317ce2 100644 --- a/ui/imports/Themes/DarkTheme.qml +++ b/ui/imports/Themes/DarkTheme.qml @@ -68,7 +68,7 @@ Theme { property color backgroundTertiary: tenPercentBlue property color pillButtonTextColor: secondaryText property color chatReplyCurrentUser: lightGrey - property color codeBackground: "#2E386B" + property color codeBackground: "#EEF2F5" property color primarySelectionColor: "#b4c8ff" property color emojiReactionBackground: "#2d2823" property color emojiReactionBackgroundHovered: "#3a3632" diff --git a/ui/imports/Themes/LightTheme.qml b/ui/imports/Themes/LightTheme.qml index 87b4523ad2..e02621b26e 100644 --- a/ui/imports/Themes/LightTheme.qml +++ b/ui/imports/Themes/LightTheme.qml @@ -68,7 +68,7 @@ Theme { property color backgroundTertiary: tenPercentBlue property color pillButtonTextColor: white property color chatReplyCurrentUser: darkGrey - property color codeBackground: "#2E386B" + property color codeBackground: "#EEF2F5" property color primarySelectionColor: "#b4c8ff" property color emojiReactionBackground: "#e2e6e9" property color emojiReactionBackgroundHovered: "#d7dadd" diff --git a/ui/imports/Themes/Theme.qml b/ui/imports/Themes/Theme.qml index 2aae1c62e2..eadf36730c 100644 --- a/ui/imports/Themes/Theme.qml +++ b/ui/imports/Themes/Theme.qml @@ -12,6 +12,8 @@ QtObject { property QtObject fontHexLight: FontLoader { id: _fontHexLight; source: "../../fonts/InterStatus/InterStatus-Light.otf"; } property QtObject fontHexRegular: FontLoader { id: _fontHexRegular; source: "../../fonts/InterStatus/InterStatus-Regular.otf"; } + property QtObject fontCodeRegular: FontLoader { id: _fontCodeRegular; source: "../../fonts/RobotoMono/RobotoMono-Regular.ttf"; } + property string name property color white diff --git a/ui/imports/Utils.qml b/ui/imports/Utils.qml index af496fa556..ee3ba27c98 100644 --- a/ui/imports/Utils.qml +++ b/ui/imports/Utils.qml @@ -53,8 +53,13 @@ QtObject { return ``+ - ``+ - ``+ - `${msg}`+ - ``+ - `` + `a {`+ + `color: ${isCurrentUser && !useCompactMode ? Style.current.white : Style.current.textColor};`+ + `}`+ + `a.mention {`+ + `color: ${isCurrentUser ? Style.current.mentionColor : Style.current.turquoise};`+ + `background-color: ${Style.current.mentionBgColor};` + + `}`+ + ``+ + ``+ + ``+ + `${msg}`+ + ``+ + `` } function getAppSectionIndex(section) {