Skip to content

Commit

Permalink
Merge pull request #10119 from Snuffleupagus/rm-onFileAttachmentAnnot…
Browse files Browse the repository at this point in the history
…ation

Attempt to simplify the `fileattachmentannotation` event dispatching
  • Loading branch information
timvandermeij authored Oct 2, 2018
2 parents 25446db + d60ce99 commit 1383245
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 31 deletions.
21 changes: 12 additions & 9 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

this.linkService.onFileAttachmentAnnotation({
id: stringToPDFString(file.filename),
filename: file.filename,
content: file.content,
});
const { filename, content, } = this.data.file;
this.filename = getFilenameFromUrl(filename);
this.content = content;

if (this.linkService.eventBus) {
this.linkService.eventBus.dispatch('fileattachmentannotation', {
source: this,
id: stringToPDFString(filename),
filename,
content,
});
}
}

/**
Expand Down
5 changes: 0 additions & 5 deletions web/interfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 0 additions & 17 deletions web/pdf_link_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 1383245

Please sign in to comment.