2020-07-15 21:04:14 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import "../../../../../shared"
|
|
|
|
import "../../../../../imports"
|
|
|
|
|
|
|
|
StyledTextEdit {
|
|
|
|
id: chatText
|
|
|
|
visible: contentType == Constants.messageType || isEmoji
|
|
|
|
textFormat: Text.RichText
|
2020-07-20 21:22:36 +00:00
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
font.pixelSize: 15
|
|
|
|
readOnly: true
|
|
|
|
selectByMouse: true
|
|
|
|
color: Style.current.textColor
|
2020-07-20 21:59:01 +00:00
|
|
|
z: 51
|
|
|
|
onLinkActivated: function (link) {
|
|
|
|
if(link.startsWith("#")){
|
|
|
|
chatsModel.joinChat(link.substring(1), Constants.chatTypePublic);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (link.startsWith('//')) {
|
|
|
|
let pk = link.replace("//", "");
|
|
|
|
profileClick(chatsModel.userNameOrAlias(pk), pk, chatsModel.generateIdenticon(pk))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt.openUrlExternally(link)
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
text: {
|
|
|
|
if(contentType === Constants.stickerType) return "";
|
|
|
|
let msg = Utils.linkifyAndXSS(message);
|
|
|
|
if(isEmoji){
|
|
|
|
return Emoji.parse(msg, "72x72");
|
|
|
|
} else {
|
2020-07-20 21:22:36 +00:00
|
|
|
return `<html>`+
|
|
|
|
`<head>`+
|
|
|
|
`<style type="text/css">`+
|
|
|
|
`code {`+
|
|
|
|
`background-color: #1a356b;`+
|
|
|
|
`color: #FFFFFF;`+
|
|
|
|
`white-space: pre;`+
|
|
|
|
`}`+
|
|
|
|
`p {`+
|
|
|
|
`white-space: pre-wrap;`+
|
|
|
|
`}`+
|
2020-08-05 12:38:45 +00:00
|
|
|
`a {`+
|
|
|
|
`color: ${isCurrentUser ? Style.current.white : Style.current.textColor};`+
|
|
|
|
`}`+
|
2020-07-20 21:22:36 +00:00
|
|
|
`a.mention {`+
|
2020-08-05 12:38:45 +00:00
|
|
|
`color: ${isCurrentUser ? Style.current.cyan : Style.current.turquoise};`+
|
2020-07-20 21:22:36 +00:00
|
|
|
`}`+
|
|
|
|
`blockquote {`+
|
|
|
|
`margin: 0;`+
|
|
|
|
`padding: 0;`+
|
|
|
|
`}`+
|
|
|
|
`</style>`+
|
|
|
|
`</head>`+
|
|
|
|
`<body>`+
|
|
|
|
`${Emoji.parse(msg, "26x26")}`+
|
|
|
|
`</body>`+
|
|
|
|
`</html>`;
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|