Link Previewer MXC Links

- Update link preview to get valid mxc links.
- Get the connection from a room.
This commit is contained in:
James Graham
2023-05-01 09:12:16 +00:00
parent bc317514e6
commit 7156bf0711
4 changed files with 58 additions and 11 deletions

View File

@@ -13,6 +13,11 @@ import org.kde.neochat 1.0
Loader {
id: root
/**
* @brief The room that the component is created in.
*/
property var room
/**
* @brief Get a list of hyperlinks in the text.
*
@@ -33,6 +38,7 @@ Loader {
}
LinkPreviewer {
id: linkPreviewer
room: root.room
url: root.links && root.links.length > 0 ? root.links[0] : ""
}
@@ -76,7 +82,7 @@ Loader {
visible: linkPreviewer.imageSource
Layout.maximumHeight: root.defaultHeight
Layout.maximumWidth: root.defaultHeight
source: linkPreviewer.imageSource.replace("mxc://", "image://mxc/")
source: linkPreviewer.imageSource
fillMode: Image.PreserveAspectFit
}
ColumnLayout {

View File

@@ -35,6 +35,7 @@ TimelineContainer {
}
LinkPreviewDelegate {
Layout.fillWidth: true
room: currentRoom
indicatorEnabled: messageDelegate.isVisibleInTimeline()
}
}