mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-05-31 07:11:00 +02:00
Make sure the focus moves on the first page of the added pdf after a merge (bug 2034827)
This commit is contained in:
parent
cd1b5f57c7
commit
a6cb30a9e5
@ -3084,6 +3084,12 @@ describe("Reorganize Pages View", () => {
|
||||
() => parseInt(document.getElementById("pageNumber").max, 10) === 6
|
||||
);
|
||||
|
||||
// Focus must move to the first newly inserted page (page 3, since
|
||||
// we merged after page 2).
|
||||
await page.waitForFunction(
|
||||
() => window.PDFViewerApplication.page === 3
|
||||
);
|
||||
|
||||
// Pages 1–2 come from the original document, then all 3 pages of
|
||||
// the merged PDF, then pages 4–6 of the original shifted to the end.
|
||||
await waitForHavingContents(page, [1, 2, 1, 2, 3, 3]);
|
||||
|
||||
@ -1874,7 +1874,8 @@ const PDFViewerApplication = {
|
||||
}
|
||||
this.pdfHistory.initialize({
|
||||
fingerprint,
|
||||
resetHistory: viewOnLoad === ViewOnLoad.INITIAL,
|
||||
resetHistory:
|
||||
viewOnLoad === ViewOnLoad.INITIAL || !!this._mergedDocumentNeedsSaving,
|
||||
updateUrl: AppOptions.get("historyUpdateUrl"),
|
||||
});
|
||||
|
||||
@ -2440,6 +2441,7 @@ const PDFViewerApplication = {
|
||||
return;
|
||||
}
|
||||
this._mergedDocumentNeedsSaving = true;
|
||||
|
||||
this.open({
|
||||
data: modifiedPdfBytes,
|
||||
filename: this._docFilename,
|
||||
|
||||
@ -338,7 +338,7 @@ class PDFThumbnailViewer {
|
||||
insertAfter: currentPageIndex ?? -1,
|
||||
});
|
||||
this.eventBus._on(
|
||||
"thumbnailsloaded",
|
||||
"pagesloaded",
|
||||
() => {
|
||||
// Clear any pre-merge selection: thumbnails are rebuilt fresh
|
||||
// (all unchecked), so the old set would cause a label/visual
|
||||
@ -358,7 +358,10 @@ class PDFThumbnailViewer {
|
||||
this.#selectPage(i + 1, true);
|
||||
}
|
||||
if (insertedPagesCount) {
|
||||
this.#updateCurrentPage(currentPageIndex + 2);
|
||||
this.#updateCurrentPage(
|
||||
currentPageIndex + 2,
|
||||
/* force = */ true
|
||||
);
|
||||
}
|
||||
},
|
||||
{ once: true }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user