status-desktop/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatReply.qml

85 lines
3.3 KiB
QML
Raw Normal View History

import QtQuick 2.3
import "../../../../../shared"
import "../../../../../imports"
Loader {
property int textFieldWidth: item ? item.textField.width : 0
property bool longReply: false
2020-09-22 14:30:49 +00:00
property color elementsColor: isCurrentUser ? Style.current.chatReplyCurrentUser : Style.current.secondaryText
id: root
active: responseTo != "" && replyMessageIndex > -1
sourceComponent: Component {
Rectangle {
property alias textField: lblReplyMessage
id: chatReply
visible: responseTo != "" && replyMessageIndex > -1
// childrenRect.height shows a binding loop for soem reason, so we use heights instead
height: this.visible ? lblReplyAuthor.height + ((repliedMessageType === Constants.imageType ? imgReplyImage.height : lblReplyMessage.height) + 5 + 8) : 0
color: Style.current.transparent
StyledTextEdit {
id: lblReplyAuthor
text: "↳" + repliedMessageAuthor
color: root.elementsColor
readOnly: true
selectByMouse: true
wrapMode: Text.Wrap
anchors.left: parent.left
anchors.right: parent.right
}
ChatImage {
id: imgReplyImage
visible: repliedMessageType == Constants.imageType
imageWidth: 50
imageSource: repliedMessageImage
anchors.top: lblReplyAuthor.bottom
anchors.topMargin: 5
anchors.left: parent.left
chatHorizontalPadding: 0
}
StyledTextEdit {
id: lblReplyMessage
visible: repliedMessageType != Constants.imageType
anchors.top: lblReplyAuthor.bottom
anchors.topMargin: 5
2020-11-26 17:35:13 +00:00
text: `<style type="text/css">`+
2020-11-26 14:42:10 +00:00
`a {`+
`color: ${isCurrentUser && !appSettings.compactMode ? Style.current.white : Style.current.textColor};`+
`}`+
`a.mention {`+
`color: ${isCurrentUser ? Style.current.cyan : Style.current.turquoise};`+
`}`+
`</style>`+
`</head>`+
`<body>`+
2020-11-26 17:35:13 +00:00
`${Emoji.parse(Utils.linkifyAndXSS(repliedMessageContent), "26x26")}`+
2020-11-26 14:42:10 +00:00
`</body>`+
`</html>`
textFormat: Text.RichText
color: root.elementsColor
readOnly: true
selectByMouse: true
wrapMode: Text.Wrap
anchors.left: parent.left
anchors.right: root.longReply ? parent.right : undefined
z: 51
}
Separator {
anchors.top: repliedMessageType == Constants.imageType ? imgReplyImage.bottom : lblReplyMessage.bottom
anchors.topMargin: repliedMessageType == Constants.imageType ? 15 : 8
anchors.left: lblReplyMessage.left
anchors.right: lblReplyMessage.right
anchors.rightMargin: chatTextItem.chatHorizontalPadding
color: root.elementsColor
}
}
}
}