Skip to content

Commit

Permalink
Merge branch 'main' into main-57
Browse files Browse the repository at this point in the history
  • Loading branch information
MikDal002 authored Apr 13, 2024
2 parents 3f578d7 + 83e6478 commit 6e7d811
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bookbinder",
"version": "1.3.7",
"version": "1.4.0",
"description": "An app to rearrange PDF pages for printing for bookbinding",
"type": "module",
"scripts": {
Expand Down
11 changes: 7 additions & 4 deletions src/models/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ export const schema = z.object({
bottomEdgePaddingPt: urlSafe(z.coerce.number()).default(0),
sigFormat,
sigLength: urlSafe(z.coerce.number()).default(4), // Specific to standard
customSigLength: urlSafe(commaSeparatedNumberList).default([]), // Specific to custom.
customSigLength: urlSafe(commaSeparatedNumberList).default(null), // Specific to custom.
foreEdgePaddingPt: urlSafe(z.coerce.number()).default(0), // specific to wacky small
wackySpacing, // specific to wacky small
flyleafs: urlSafe(z.coerce.number()).default(1),
paperSizeCustomWidth: urlSafe(z.coerce.number()),
paperSizeCustomHeight: urlSafe(z.coerce.number()),

frenchStitchLinkEnabled: urlSafe(coercedBoolean).default(false),
frenchStitchLinkMarginPt: urlSafe(z.coerce.number()).default(72),
frenchStitchesAmount: urlSafe(z.coerce.number()).default(3),
frenchStitchesSpacingPt: urlSafe(z.coerce.number()).default(36)
frenchStitchesSpacingPt: urlSafe(z.coerce.number()).default(36),

paperSizeCustomWidth: urlSafe(z.coerce.number()).default(0),
paperSizeCustomHeight: urlSafe(z.coerce.number()).default(0)
});

/** @typedef {z.infer<typeof schema>} Configuration */

export const defaultConfig = schema.parse({});
7 changes: 7 additions & 0 deletions src/utils/uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

import { defaultConfig } from '../models/configuration';

/**
* Gets parameters from a URL.
* @param { string } url The URL to get the params from
Expand All @@ -26,6 +28,11 @@ export const setUrlParams = (url, params) => {
continue;
}

if (value === defaultConfig[key]) {
urlRepresentation.searchParams.delete(key);
continue;
}

urlRepresentation.searchParams.set(key, String(value));
}

Expand Down

0 comments on commit 6e7d811

Please sign in to comment.