Improve Link Preview Sizing

Update linkpreviewer to minimise the number of resizes.

- There is now a placeholder loading element to hold space while the data is obtained
- The component starts with a set size but can be expanded to see the whole item.
- The expand/contract button is only visible on hover
- The default size is picked to show 3 lines of text (1 heading and 2 description, 2 heading and 1 description, etc)

This is designed to help with the timeline scroll jumping CCBUG: 463235 by minimizing the amount of resizing for items in the timeline.

Before

![image](/uploads/bb46f55dc38851e640a7382aafea8640/image.png)

After when compressed

![image](/uploads/3cbc7894688721d944a5551251b12a12/image.png)

After When expanded

![image](/uploads/50ff53fe51eefe88713a2ded34530534/image.png)

After Loading

![image](/uploads/72567f805af6b08ab0c5fc1cf94bd247/image.png)
This commit is contained in:
James Graham
2023-02-12 21:10:52 +00:00
parent 5482aad7ba
commit ea76edce74
2 changed files with 131 additions and 54 deletions

View File

@@ -29,14 +29,8 @@ TimelineContainer {
messageId: model.eventId
visible: currentRoom.chatBoxEditId === model.eventId
}
Loader {
id: linkPreviewLoader
LinkPreviewDelegate {
Layout.fillWidth: true
active: !currentRoom.usesEncryption && model.display && model.display.includes("http")
visible: Config.showLinkPreview && active
sourceComponent: LinkPreviewDelegate {
anchors.verticalCenter: parent.verticalCenter
}
}
}
}