Improve clicking link previews
First of all, clicking on them actually works - because we were missing an import for RoomManager. Secondly, we use a dedicated TapHandler since onLinkActivated sucks. We want to be able to click anywhere on the preview to go to the website/room anyway.
This commit is contained in:
@@ -8,6 +8,8 @@ import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
/**
|
||||
* @brief A component to show a link preview from a message.
|
||||
*/
|
||||
@@ -95,7 +97,6 @@ QQC2.Control {
|
||||
}
|
||||
</style>
|
||||
<a href=\"" + root.linkPreviewer.url + "\">" + (maximizeButton.checked ? root.linkPreviewer.title : titleTextMetrics.elidedText).replace("–", "—") + "</a>"
|
||||
onLinkActivated: RoomManager.resolveResource(link, "join")
|
||||
|
||||
TextMetrics {
|
||||
id: titleTextMetrics
|
||||
@@ -120,6 +121,11 @@ QQC2.Control {
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onTapped: RoomManager.resolveResource(root.linkPreviewer.url, "join")
|
||||
}
|
||||
}
|
||||
|
||||
QQC2.Button {
|
||||
|
||||
Reference in New Issue
Block a user