diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 048bfb562..a756b51f7 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1130,15 +1130,18 @@ class FileAttachmentAnnotationElement extends AnnotationElement { constructor(parameters) { super(parameters, /* isRenderable = */ true); - let file = this.data.file; - this.filename = getFilenameFromUrl(file.filename); - this.content = file.content; + const { filename, content, } = this.data.file; + this.filename = getFilenameFromUrl(filename); + this.content = content; - this.linkService.onFileAttachmentAnnotation({ - id: stringToPDFString(file.filename), - filename: file.filename, - content: file.content, - }); + if (this.linkService.eventBus) { + this.linkService.eventBus.dispatch('fileattachmentannotation', { + source: this, + id: stringToPDFString(filename), + filename, + content, + }); + } } /** diff --git a/web/interfaces.js b/web/interfaces.js index 62e4c2ce8..d90245825 100644 --- a/web/interfaces.js +++ b/web/interfaces.js @@ -67,11 +67,6 @@ class IPDFLinkService { */ executeNamedAction(action) {} - /** - * @param {Object} params - */ - onFileAttachmentAnnotation({ id, filename, content, }) {} - /** * @param {number} pageNum - page number. * @param {Object} pageRef - reference to the page. diff --git a/web/pdf_link_service.js b/web/pdf_link_service.js index a0130db7e..985be38cd 100644 --- a/web/pdf_link_service.js +++ b/web/pdf_link_service.js @@ -337,18 +337,6 @@ class PDFLinkService { }); } - /** - * @param {Object} params - */ - onFileAttachmentAnnotation({ id, filename, content, }) { - this.eventBus.dispatch('fileattachmentannotation', { - source: this, - id, - filename, - content, - }); - } - /** * @param {number} pageNum - page number. * @param {Object} pageRef - reference to the page. @@ -481,11 +469,6 @@ class SimpleLinkService { */ executeNamedAction(action) {} - /** - * @param {Object} params - */ - onFileAttachmentAnnotation({ id, filename, content, }) {} - /** * @param {number} pageNum - page number. * @param {Object} pageRef - reference to the page.