fix(ui): Resolve conflict between click on text message and click on message

Closes: #3593
This commit is contained in:
B.Melnik 2021-09-27 15:08:55 +03:00 committed by Iuri Matias
parent e0c5e9b9b0
commit 4b73d68490
3 changed files with 22 additions and 1 deletions

View File

@ -5,13 +5,18 @@ import utils 1.0
import QtGraphicalEffects 1.0
Item {
id: root
property bool longChatText: true
property bool veryLongChatText: chatsModel.plainText(message).length >
(appSettings.useCompactMode ? Constants.limitLongChatTextCompactMode : Constants.limitLongChatText)
property bool readMore: false
property alias textField: chatText
id: root
signal linkActivated(url link)
property bool linkHovered: chatText.hoveredLink !== ""
z: 51
implicitHeight: visible ? (showMoreLoader.active ? childrenRect.height - 10 : chatText.height) : 0
@ -43,6 +48,8 @@ Item {
height: root.veryLongChatText && !root.readMore ? Math.min(implicitHeight, 200) : implicitHeight
clip: height < implicitHeight
onLinkActivated: {
root.linkActivated(link)
if(link.startsWith("#")) {
const channelName = link.substring(1);
const foundChannelObj = chatsModel.getChannel(channelName);

View File

@ -384,6 +384,12 @@ Item {
anchors.leftMargin: -leftPadding
textField.leftPadding: leftPadding
textField.rightPadding: Style.current.bigPadding
onLinkActivated: {
if (activityCenterMessage) {
clickMessage(false, isSticker, false)
}
}
}
Loader {
@ -446,6 +452,7 @@ Item {
MessageMouseArea {
id: messageMouseArea
enabled: !chatText.linkHovered
anchors.fill: stickerLoader.active ? stickerLoader : chatText
z: activityCenterMessage ? chatText.z + 1 : chatText.z -1
}

View File

@ -151,6 +151,12 @@ Item {
chatText.setWidths()
}
}
onLinkActivated: {
if (activityCenterMessage) {
clickMessage(false, isSticker, false)
}
}
}
Loader {
@ -208,6 +214,7 @@ Item {
MessageMouseArea {
anchors.fill: parent
enabled: !chatText.linkHovered
}
RectangleCorner {