diff --git a/src/models/configuration.js b/src/models/configuration.js index 3eb1f3d..20e2594 100644 --- a/src/models/configuration.js +++ b/src/models/configuration.js @@ -36,7 +36,7 @@ const sourceRotation = urlSafe(z.enum(["none", "90cw", "90ccw", "out_binding", " /** @type { keyof typeof import("../constants").PAGE_SIZES } */ const availablePaperSizes = Object.keys(PAGE_SIZES); -const paperSize = urlSafe(z.enum(availablePaperSizes)).default("A4"); +const paperSize = urlSafe(z.enum([...availablePaperSizes, "CUSTOM"])).default("A4"); const paperSizeUnit = urlSafe(z.enum(["pt", "in", "cm"])).default("pt"); @@ -52,12 +52,9 @@ const sigFormat = urlSafe(z.enum(["perfect", "standardsig", "customsig", "1_3rd" const wackySpacing = urlSafe(z.enum(["wacky_pack", "wacky_gap"])).default("wacky_pack"); -const fileDownload = urlSafe(z.enum(["aggregated", "both", "signatures"]).default("both")); - const printFile = urlSafe(z.enum(["aggregated", "signatures", "both"])).default("both"); export const schema = z.object({ - fileDownload, printFile, sourceRotation, rotatePage: urlSafe(coercedBoolean).default(false), diff --git a/src/utils/renderUtils.js b/src/utils/renderUtils.js index 9198697..0d595e0 100644 --- a/src/utils/renderUtils.js +++ b/src/utils/renderUtils.js @@ -197,12 +197,12 @@ export function renderFormFromSettings(configuration) { document.querySelector('select[name="printer_type"]').value = configuration.printerType; // Set options which are not always present - if (configuration.paperSizeCustomHeight !== undefined) { + if (configuration.paperSize === "CUSTOM" && configuration.paperSizeCustomHeight !== undefined && configuration.paperSizeCustomWidth !== undefined) { document.querySelector('input[name="paper_size_custom_height"]').value = configuration.paperSizeCustomHeight; - } - - if (configuration.paperSizeCustomWidth !== undefined) { document.querySelector('input[name="paper_size_custom_width"]').value = configuration.paperSizeCustomWidth; + updateAddOrRemoveCustomPaperOption(); + updatePaperSelectOptionsUnits(); + document.querySelector('select[name="paper_size"]').value = "CUSTOM"; } if (configuration.sigFormat == "customsig") {