@fluid-topics/ft-reader-attachments 1.2.58 → 1.2.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,6 +14,7 @@ export declare class FtReaderAttachments extends FtReaderAttachments_base implem
|
|
|
14
14
|
attachments?: Array<FtMapAttachment>;
|
|
15
15
|
constructor();
|
|
16
16
|
protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
17
|
+
private getAttachmentAriaLabel;
|
|
17
18
|
protected update(props: PropertyValues): void;
|
|
18
19
|
private updateAttachments;
|
|
19
20
|
}
|
|
@@ -40,7 +40,8 @@ class FtReaderAttachments extends withI18n(FtReaderComponent) {
|
|
|
40
40
|
const url = attachment.externalLink ? attachment.viewerUrl : (_a = this.service) === null || _a === void 0 ? void 0 : _a.makeAbsolute((_b = attachment.viewerUrl) !== null && _b !== void 0 ? _b : "");
|
|
41
41
|
return html `
|
|
42
42
|
<div part="attachment">
|
|
43
|
-
<a part="viewer-link" href="${url}"
|
|
43
|
+
<a part="viewer-link" href="${url}"
|
|
44
|
+
aria-label="${this.getAttachmentAriaLabel(attachment)}">
|
|
44
45
|
<ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
|
|
45
46
|
<ft-icon part="file-format-icon"
|
|
46
47
|
variant="file-format"
|
|
@@ -53,7 +54,7 @@ class FtReaderAttachments extends withI18n(FtReaderComponent) {
|
|
|
53
54
|
: html `
|
|
54
55
|
<a part="download-link"
|
|
55
56
|
href="${(_d = this.service) === null || _d === void 0 ? void 0 : _d.getAttachmentDownloadLink(attachment.id)}"
|
|
56
|
-
aria-label="${attachmentsMessages.messages.download(attachment
|
|
57
|
+
aria-label="${attachmentsMessages.messages.download(this.getAttachmentAriaLabel(attachment))}">
|
|
57
58
|
<ft-ripple part="ripple download-link-ripple"></ft-ripple>
|
|
58
59
|
<ft-icon part="download-icon">DOWNLOAD</ft-icon>
|
|
59
60
|
</a>
|
|
@@ -66,6 +67,16 @@ class FtReaderAttachments extends withI18n(FtReaderComponent) {
|
|
|
66
67
|
}
|
|
67
68
|
return nothing;
|
|
68
69
|
}
|
|
70
|
+
getAttachmentAriaLabel(attachment) {
|
|
71
|
+
var _a;
|
|
72
|
+
let displayName = attachment.name;
|
|
73
|
+
let fileName = attachment.file;
|
|
74
|
+
if (displayName === fileName) {
|
|
75
|
+
return fileName;
|
|
76
|
+
}
|
|
77
|
+
let fileExtension = (_a = (fileName.includes(".") ? fileName.split(".").pop() : attachment.mimeType)) !== null && _a !== void 0 ? _a : "";
|
|
78
|
+
return displayName + " " + fileExtension;
|
|
79
|
+
}
|
|
69
80
|
update(props) {
|
|
70
81
|
super.update(props);
|
|
71
82
|
if (props.has("map")) {
|