fix: fix text selection by putting mouseArea under text
And put link click handling by the TextField itself
This commit is contained in:
parent
601d237fde
commit
a9cddde37e
|
@ -234,6 +234,7 @@ QtObject:
|
|||
|
||||
proc joinChat*(self: ChatsView, channel: string, chatTypeInt: int): int {.slot.} =
|
||||
self.status.chat.join(channel, ChatType(chatTypeInt))
|
||||
self.setActiveChannel(channel)
|
||||
|
||||
proc joinGroup*(self: ChatsView) {.slot.} =
|
||||
self.status.chat.confirmJoiningGroup(self.activeChannel.id)
|
||||
|
|
|
@ -35,6 +35,7 @@ Rectangle {
|
|||
wrapMode: Text.Wrap
|
||||
anchors.left: parent.left
|
||||
anchors.right: chatReply.longReply ? parent.right : undefined
|
||||
z: 51
|
||||
}
|
||||
|
||||
Separator {
|
||||
|
|
|
@ -12,6 +12,21 @@ StyledTextEdit {
|
|||
readOnly: true
|
||||
selectByMouse: true
|
||||
color: Style.current.textColor
|
||||
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)
|
||||
}
|
||||
text: {
|
||||
if(contentType === Constants.stickerType) return "";
|
||||
let msg = Utils.linkifyAndXSS(message);
|
||||
|
@ -44,6 +59,5 @@ StyledTextEdit {
|
|||
`</body>`+
|
||||
`</html>`;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,27 +3,14 @@ import "../../../../../shared"
|
|||
import "../../../../../imports"
|
||||
|
||||
MouseArea {
|
||||
cursorShape: chatText.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
cursorShape: chatText.hoveredLink ? Qt.PointingHandCursor : undefined
|
||||
acceptedButtons: Qt.RightButton
|
||||
z: 50
|
||||
onClicked: {
|
||||
if(mouse.button & Qt.RightButton) {
|
||||
clickMessage()
|
||||
return;
|
||||
}
|
||||
|
||||
let link = chatText.hoveredLink;
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue