[api-minor] Expose the /Desc-attribute of file attachments in the viewer (issue 18030)

In the viewer this will be displayed in the `title` of the hyperlink, which is probably the best we can do here given how the viewer is implemented.
This commit is contained in:
Jonas Jenwald 2024-04-30 18:51:31 +02:00
parent 1241758605
commit bf4e36d1b5
7 changed files with 48 additions and 12 deletions

View file

@ -857,6 +857,9 @@ class LinkAnnotationElement extends AnnotationElement {
*/
#bindAttachment(link, attachment, dest = null) {
link.href = this.linkService.getAnchorUrl("");
if (attachment.description) {
link.title = attachment.description;
}
link.onclick = () => {
this.downloadManager?.openOrDownloadData(
attachment.content,
@ -2856,7 +2859,7 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
constructor(parameters) {
super(parameters, { isRenderable: true });
const { filename, content } = this.data.file;
const { filename, content, description } = this.data.file;
this.filename = getFilenameFromUrl(filename, /* onlyStripPath = */ true);
this.content = content;
@ -2864,6 +2867,7 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
source: this,
filename,
content,
description,
});
}