Show file name and size on images on hover (#6511)
* Show simple file name and size on images/videos Fixes https://github.com/vector-im/element-web/issues/18197 * i18n * Fix bad merge * Add hover state tracking * Only show on timeline-like objects * Match new design requirements * Remove video support (deemed not needed) * Colouring and sizing from design * Include file name in lightbox * Revert changes to videos since we don't need them * i18n * Iterate PR Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
f54d54b3ff
commit
f51a6b6da4
7 changed files with 52 additions and 4 deletions
|
@ -37,7 +37,7 @@ export function presentableTextForFile(
|
|||
shortened = false,
|
||||
): string {
|
||||
let text = fallbackText;
|
||||
if (content.body && content.body.length > 0) {
|
||||
if (content.body?.length > 0) {
|
||||
// The content body should be the name of the file including a
|
||||
// file extension.
|
||||
text = content.body;
|
||||
|
@ -58,7 +58,7 @@ export function presentableTextForFile(
|
|||
text = `${fileName}...${extension}`;
|
||||
}
|
||||
|
||||
if (content.info && content.info.size && withSize) {
|
||||
if (content.info?.size && withSize) {
|
||||
// If we know the size of the file then add it as human readable
|
||||
// string to the end of the link text so that the user knows how
|
||||
// big a file they are downloading.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue