Merge pull request #10119 from Snuffleupagus/rm-onFileAttachmentAnnotation
Attempt to simplify the `fileattachmentannotation` event dispatching
This commit is contained in:
commit
138324502c
@ -1130,15 +1130,18 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
|
|||||||
constructor(parameters) {
|
constructor(parameters) {
|
||||||
super(parameters, /* isRenderable = */ true);
|
super(parameters, /* isRenderable = */ true);
|
||||||
|
|
||||||
let file = this.data.file;
|
const { filename, content, } = this.data.file;
|
||||||
this.filename = getFilenameFromUrl(file.filename);
|
this.filename = getFilenameFromUrl(filename);
|
||||||
this.content = file.content;
|
this.content = content;
|
||||||
|
|
||||||
this.linkService.onFileAttachmentAnnotation({
|
if (this.linkService.eventBus) {
|
||||||
id: stringToPDFString(file.filename),
|
this.linkService.eventBus.dispatch('fileattachmentannotation', {
|
||||||
filename: file.filename,
|
source: this,
|
||||||
content: file.content,
|
id: stringToPDFString(filename),
|
||||||
});
|
filename,
|
||||||
|
content,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,11 +67,6 @@ class IPDFLinkService {
|
|||||||
*/
|
*/
|
||||||
executeNamedAction(action) {}
|
executeNamedAction(action) {}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} params
|
|
||||||
*/
|
|
||||||
onFileAttachmentAnnotation({ id, filename, content, }) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} pageNum - page number.
|
* @param {number} pageNum - page number.
|
||||||
* @param {Object} pageRef - reference to the page.
|
* @param {Object} pageRef - reference to the page.
|
||||||
|
@ -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 {number} pageNum - page number.
|
||||||
* @param {Object} pageRef - reference to the page.
|
* @param {Object} pageRef - reference to the page.
|
||||||
@ -481,11 +469,6 @@ class SimpleLinkService {
|
|||||||
*/
|
*/
|
||||||
executeNamedAction(action) {}
|
executeNamedAction(action) {}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} params
|
|
||||||
*/
|
|
||||||
onFileAttachmentAnnotation({ id, filename, content, }) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} pageNum - page number.
|
* @param {number} pageNum - page number.
|
||||||
* @param {Object} pageRef - reference to the page.
|
* @param {Object} pageRef - reference to the page.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user