mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
[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:
parent
1241758605
commit
bf4e36d1b5
7 changed files with 48 additions and 12 deletions
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue