mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-02 08:10:59 +02:00
Prompt the user for saving a merged pdf (bug 2034461)
This commit is contained in:
parent
bede5e5bfa
commit
302bc5f4d9
@ -3096,5 +3096,32 @@ describe("Reorganize Pages View", () => {
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it("must mark document as needing save after merge (bug 2034461)", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await waitForThumbnailVisible(page, 1);
|
||||
|
||||
const handleMerged = await createPromise(page, resolve => {
|
||||
window.PDFViewerApplication.eventBus._on(
|
||||
"thumbnailsloaded",
|
||||
resolve,
|
||||
{ once: true }
|
||||
);
|
||||
});
|
||||
|
||||
const picker = await page.$("#viewsManagerAddFilePicker");
|
||||
await picker.uploadFile(
|
||||
path.join(__dirname, "../pdfs/three_pages_with_number.pdf")
|
||||
);
|
||||
await awaitPromise(handleMerged);
|
||||
|
||||
const hasChanges = await page.evaluate(() =>
|
||||
window.PDFViewerApplication._hasChanges()
|
||||
);
|
||||
expect(hasChanges).withContext(`In ${browserName}`).toBeTrue();
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1352,6 +1352,8 @@ const PDFViewerApplication = {
|
||||
? this.save()
|
||||
: this.download());
|
||||
}
|
||||
delete this._mergedDocumentNeedsSaving;
|
||||
this.setTitle();
|
||||
classList.remove("wait");
|
||||
},
|
||||
|
||||
@ -1898,7 +1900,8 @@ const PDFViewerApplication = {
|
||||
_hasChanges() {
|
||||
return (
|
||||
this.pdfDocument?.annotationStorage.size > 0 ||
|
||||
this.pdfThumbnailViewer?.hasStructuralChanges()
|
||||
this.pdfThumbnailViewer?.hasStructuralChanges() ||
|
||||
this._mergedDocumentNeedsSaving === true
|
||||
);
|
||||
},
|
||||
|
||||
@ -2436,6 +2439,7 @@ const PDFViewerApplication = {
|
||||
);
|
||||
return;
|
||||
}
|
||||
this._mergedDocumentNeedsSaving = true;
|
||||
this.open({
|
||||
data: modifiedPdfBytes,
|
||||
filename: this._docFilename,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user