#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Restore the pixel comparison mode toggle in the Compare tool (#8931)
Anthony Stirling8f75c37a5a14
diff --git a/frontend/public/locales/en-US/translation.toml b/frontend/public/locales/en-US/translation.tomlindex d492bb98a3..1c5e06e481 100644--- a/frontend/public/locales/en-US/translation.toml+++ b/frontend/public/locales/en-US/translation.toml@@ -3975,6 +3975,10 @@ message = "One or Both of the provided documents are too large to process"body = "These PDFs together exceed 2,000 pages. Processing can take several minutes."title = "Large comparison in progress"+[compare.mode]+pixel = "Pixel Comparison"+text = "Text Comparison"+[compare.no.text]message = "One or both of the selected PDFs have no text content. Please choose PDFs with text for comparison."diff --git a/frontend/src/editor/core/tests/stubbed/compare.spec.ts b/frontend/src/editor/core/tests/stubbed/compare.spec.tsindex 88347448f5..94525579e9 100644--- a/frontend/src/editor/core/tests/stubbed/compare.spec.ts+++ b/frontend/src/editor/core/tests/stubbed/compare.spec.ts@@ -237,6 +237,24 @@ test.describe("Compare tool slot selection", () => {).toHaveAttribute("data-slot-state", "empty");});+ test("Pixel Comparison mode renders the pixel diff view", async ({+ page,+ }) => {+ await navigateToCompare(page);+ await page.getByText("Pixel Comparison", { exact: true }).click();+ await uploadIntoSlot(page, "base", PDF_A, "compare_sample_a.pdf");+ await uploadIntoSlot(page, "comparison", PDF_B, "compare_sample_b.pdf");++ await page.getByRole("button", { name: "Compare", exact: true }).click();++ await expect(page.locator(".compare-pixel-workbench")).toBeVisible({+ timeout: 30000,+ });+ await expect(page.locator(".compare-pixel-page").first()).toBeVisible({+ timeout: 30000,+ });+ });+// These specs stop at slot state. Actually running a comparison lives in// `engine-capabilities.spec.ts`, which is cross-browser in PR CI.});diff --git a/frontend/src/editor/core/tools/Compare.tsx b/frontend/src/editor/core/tools/Compare.tsxindex 646a96681a..ba88fe7091 100644--- a/frontend/src/editor/core/tools/Compare.tsx+++ b/frontend/src/editor/core/tools/Compare.tsx@@ -21,7 +21,8 @@ import { useNavigationActions } from "@editor/contexts/NavigationContext";import type { FileId } from "@editor/types/file";import type { StirlingFile } from "@editor/types/fileContext";import DocumentThumbnail from "@editor/components/shared/filePreview/DocumentThumbnail";-import type { CompareWorkbenchData } from "@editor/types/compare";+import type { CompareMode, CompareWorkbenchData } from "@editor/types/compare";+import ButtonSelector from "@editor/components/shared/ButtonSelector";import { getDefaultWorkbench } from "@editor/types/workbench";import { truncateCenter } from "@editor/utils/textUtils";import { registerPolicyFileUsage } from "@editor/services/policyBlockRegistry";@@ -497,6 +498,24 @@ const Compare = (props: BaseToolProps) => {</Button></div>+ <ButtonSelector<CompareMode>+ value={params.mode}+ onChange={(mode) =>+ base.params.setParameters((prev) => ({ ...prev, mode }))+ }+ disabled={base.operation.isLoading}+ options={[+ {+ value: "text",+ label: t("compare.mode.text", "Text Comparison"),+ },+ {+ value: "pixel",+ label: t("compare.mode.pixel", "Pixel Comparison"),+ },+ ]}+ />+<Text fw={700} size="sm" style={{ margin: 0 }}>{t("compare.original.label", "Original PDF")}</Text>