mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
TextMessageDelegate: pass correct background color to markdown parsing
Change-Id: I947a924a5476ef6e4fe6b759e63cc2fd3bf68162 GitLab: #1139
This commit is contained in:
parent
ce58d238a9
commit
a8586ecfd6
1 changed files with 16 additions and 4 deletions
|
@ -32,6 +32,18 @@ SBSMessageBase {
|
||||||
property bool isEmojiOnly: IsEmojiOnly
|
property bool isEmojiOnly: IsEmojiOnly
|
||||||
property real maxMsgWidth: root.width - senderMargin - 2 * hPadding - avatarBlockWidth
|
property real maxMsgWidth: root.width - senderMargin - 2 * hPadding - avatarBlockWidth
|
||||||
property string colorUrl: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark
|
property string colorUrl: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark
|
||||||
|
property string colorText: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: bubble
|
||||||
|
function onColorChanged(color) {
|
||||||
|
root.colorUrl = UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewLinkColorLight : JamiTheme.chatviewLinkColorDark
|
||||||
|
root.colorText = UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
|
||||||
|
// Update parsed body with correct colors
|
||||||
|
if (Body !== "")
|
||||||
|
MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, bubble.color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isOutgoing: Author === CurrentAccount.uri
|
isOutgoing: Author === CurrentAccount.uri
|
||||||
author: Author
|
author: Author
|
||||||
|
@ -52,7 +64,7 @@ SBSMessageBase {
|
||||||
anchors.right: isOutgoing ? parent.right : undefined
|
anchors.right: isOutgoing ? parent.right : undefined
|
||||||
text: {
|
text: {
|
||||||
if (Body !== "" && ParsedBody.length === 0) {
|
if (Body !== "" && ParsedBody.length === 0) {
|
||||||
MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, CurrentConversation.color);
|
MessagesAdapter.parseMessage(Id, Body, UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews), root.colorUrl, bubble.color);
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return (ParsedBody !== "") ? ParsedBody : "<i>(" + JamiStrings.deletedMessage + ")</i>";
|
return (ParsedBody !== "") ? ParsedBody : "<i>(" + JamiStrings.deletedMessage + ")</i>";
|
||||||
|
@ -144,7 +156,7 @@ SBSMessageBase {
|
||||||
Layout.bottomMargin: JamiTheme.preferredMarginSize
|
Layout.bottomMargin: JamiTheme.preferredMarginSize
|
||||||
|
|
||||||
text: JamiStrings.edited
|
text: JamiStrings.edited
|
||||||
color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
|
color: root.colorText
|
||||||
font.pointSize: JamiTheme.editedFontSize
|
font.pointSize: JamiTheme.editedFontSize
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
|
@ -228,7 +240,7 @@ SBSMessageBase {
|
||||||
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
textFormat: TextEdit.RichText
|
textFormat: TextEdit.RichText
|
||||||
color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
|
color: root.colorText
|
||||||
visible: LinkPreviewInfo.title.length > 0
|
visible: LinkPreviewInfo.title.length > 0
|
||||||
text: LinkPreviewInfo.title
|
text: LinkPreviewInfo.title
|
||||||
}
|
}
|
||||||
|
@ -251,7 +263,7 @@ SBSMessageBase {
|
||||||
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
textFormat: TextEdit.RichText
|
textFormat: TextEdit.RichText
|
||||||
color: UtilsAdapter.luma(bubble.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark
|
color: root.colorText
|
||||||
text: LinkPreviewInfo.domain
|
text: LinkPreviewInfo.domain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue