diff --git a/gulpfile.mjs b/gulpfile.mjs index 7513473847c81..db428b7da57ef 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -2403,6 +2403,9 @@ function buildInternalViewer(defines, dir) { ]) ) .pipe(gulp.dest(dir + "web")), + createCMapBundle().pipe(gulp.dest(dir + "web/cmaps")), + createICCBundle().pipe(gulp.dest(dir + "web/iccs")), + createStandardFontBundle().pipe(gulp.dest(dir + "web/standard_fonts")), createWasmBundle().pipe(gulp.dest(dir + "web/wasm")), ]); } diff --git a/test/integration/reorganize_pages_spec.mjs b/test/integration/reorganize_pages_spec.mjs index 2e1b874b985ed..2b7f4901726d7 100644 --- a/test/integration/reorganize_pages_spec.mjs +++ b/test/integration/reorganize_pages_spec.mjs @@ -1331,6 +1331,49 @@ describe("Reorganize Pages View", () => { }) ); }); + + it("should deselect all thumbnails when the deselect button is clicked", async () => { + await Promise.all( + pages.map(async ([browserName, page]) => { + await waitForThumbnailVisible(page, 1); + await page.waitForSelector("#viewsManagerStatusActionButton", { + visible: true, + }); + + const labelSelector = "#viewsManagerStatusActionLabel"; + const deselectButtonSelector = + "#viewsManagerStatusActionDeselectButton"; + + // Check thumbnails 1 and 2. + await waitAndClick( + page, + `.thumbnail:has(${getThumbnailSelector(1)}) input` + ); + await waitAndClick( + page, + `.thumbnail:has(${getThumbnailSelector(2)}) input` + ); + await waitForTextToBe(page, labelSelector, `${FSI}2${PDI} selected`); + + // Click the deselect button: all thumbnails should be unchecked. + await waitAndClick(page, deselectButtonSelector); + + // Label should revert to "Select pages". + await waitForTextToBe(page, labelSelector, "Select pages"); + + // The deselect button should be hidden again. + await page.waitForSelector(deselectButtonSelector, { hidden: true }); + + // All checkboxes should be unchecked. + await page.waitForSelector( + "#thumbnailsView:not(:has(input:checked))", + { + visible: true, + } + ); + }) + ); + }); }); describe("Undo label reflects number of cut/deleted pages (bug 2010832)", () => { diff --git a/web/pdf_internal_viewer.js b/web/pdf_internal_viewer.js index a0e5c96d71e55..aa68a54a43c4d 100644 --- a/web/pdf_internal_viewer.js +++ b/web/pdf_internal_viewer.js @@ -851,10 +851,15 @@ async function openDocument(source, name) { const loadingTask = getDocument({ ...source, - cMapUrl: "../external/bcmaps/", + cMapUrl: + typeof PDFJSDev === "undefined" ? "../external/bcmaps/" : "../web/cmaps/", + iccUrl: + typeof PDFJSDev === "undefined" ? "../external/iccs/" : "../web/iccs/", + standardFontDataUrl: + typeof PDFJSDev === "undefined" + ? "../external/standard_fonts/" + : "../web/standard_fonts/", wasmUrl: "../web/wasm/", - iccUrl: "../external/iccs/", - standardFontDataUrl: "../external/standard_fonts/", useWorkerFetch: true, pdfBug: true, CanvasFactory: DebugCanvasFactory, diff --git a/web/pdf_thumbnail_viewer.js b/web/pdf_thumbnail_viewer.js index 2a7b5838ae608..1547c3f314e1f 100644 --- a/web/pdf_thumbnail_viewer.js +++ b/web/pdf_thumbnail_viewer.js @@ -145,6 +145,8 @@ class PDFThumbnailViewer { #statusBar = null; + #deselectButton = null; + #undoBar = null; #undoLabel = null; @@ -183,6 +185,8 @@ class PDFThumbnailViewer { this.pageColors = pageColors || null; this.#enableSplitMerge = enableSplitMerge || false; this.#statusLabel = statusBar?.viewsManagerStatusActionLabel || null; + this.#deselectButton = + statusBar?.viewsManagerStatusActionDeselectButton || null; this.#statusBar = statusBar?.viewsManagerStatusAction || null; this.#undoBar = undoBar?.viewsManagerStatusUndo || null; this.#undoLabel = undoBar?.viewsManagerStatusUndoLabel || null; @@ -260,6 +264,12 @@ class PDFThumbnailViewer { "click", this.#dismissUndo.bind(this) ); + this.#deselectButton?.addEventListener("click", () => { + this.#clearSelection(); + this.#toggleMenuEntries(false); + this.#updateStatus("select"); + }); + this.#deselectButton.classList.toggle("hidden", true); } else { manageMenu.button.hidden = true; } @@ -910,8 +920,10 @@ class PDFThumbnailViewer { "data-l10n-args", JSON.stringify({ count }) ); + this.#deselectButton.classList.toggle("hidden", false); } else { this.#statusLabel.removeAttribute("data-l10n-args"); + this.#deselectButton.classList.toggle("hidden", true); } this.#statusBar.classList.toggle("hidden", false); this.#undoBar.classList.toggle("hidden", true); diff --git a/web/viewer.html b/web/viewer.html index 8cd0d8f77ae7e..fb3c351a0f745 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -188,11 +188,22 @@
- + + + +