1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Move the transfers computation into the AnnotationStorage class

Rather than having to *manually* determine the potential `transfers` at various spots in the API, we can let the `AnnotationStorage.serializable` getter include this.
To further simplify things, we can also let the `serializable` getter compute and include the `hash`-string as well.
This commit is contained in:
Jonas Jenwald 2023-06-29 08:43:02 +02:00
parent 88c7c8b5bf
commit 39113baa33
5 changed files with 66 additions and 75 deletions

View file

@ -136,9 +136,11 @@ const mockClipboard = async pages => {
exports.mockClipboard = mockClipboard;
const getSerialized = page =>
page.evaluate(() => [
...window.PDFViewerApplication.pdfDocument.annotationStorage.serializable.values(),
]);
page.evaluate(() => {
const { map } =
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable;
return map ? [...map.values()] : [];
});
exports.getSerialized = getSerialized;
function getEditors(page, kind) {