mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-03 17:52:30 +02:00
Simplify settings definition
This commit is contained in:
parent
d150d7a9da
commit
cbedb8e1ca
@ -1,6 +1,6 @@
|
||||
import { Stack, Text, Checkbox } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SanitizeParameters } from "../../../hooks/tools/sanitize/useSanitizeParameters";
|
||||
import { SanitizeParameters, defaultParameters } from "../../../hooks/tools/sanitize/useSanitizeParameters";
|
||||
|
||||
interface SanitizeSettingsProps {
|
||||
parameters: SanitizeParameters;
|
||||
@ -11,44 +11,12 @@ interface SanitizeSettingsProps {
|
||||
const SanitizeSettings = ({ parameters, onParameterChange, disabled = false }: SanitizeSettingsProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const options = [
|
||||
{
|
||||
key: 'removeJavaScript' as const,
|
||||
label: t('sanitize.options.removeJavaScript', 'Remove JavaScript'),
|
||||
description: t('sanitize.options.removeJavaScript.desc', 'Remove JavaScript actions and scripts from the PDF'),
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
key: 'removeEmbeddedFiles' as const,
|
||||
label: t('sanitize.options.removeEmbeddedFiles', 'Remove Embedded Files'),
|
||||
description: t('sanitize.options.removeEmbeddedFiles.desc', 'Remove any files embedded within the PDF'),
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
key: 'removeXMPMetadata' as const,
|
||||
label: t('sanitize.options.removeXMPMetadata', 'Remove XMP Metadata'),
|
||||
description: t('sanitize.options.removeXMPMetadata.desc', 'Remove XMP metadata from the PDF'),
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
key: 'removeMetadata' as const,
|
||||
label: t('sanitize.options.removeMetadata', 'Remove Document Metadata'),
|
||||
description: t('sanitize.options.removeMetadata.desc', 'Remove document information metadata (title, author, etc.)'),
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
key: 'removeLinks' as const,
|
||||
label: t('sanitize.options.removeLinks', 'Remove Links'),
|
||||
description: t('sanitize.options.removeLinks.desc', 'Remove external links and launch actions from the PDF'),
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
key: 'removeFonts' as const,
|
||||
label: t('sanitize.options.removeFonts', 'Remove Fonts'),
|
||||
description: t('sanitize.options.removeFonts.desc', 'Remove embedded fonts from the PDF'),
|
||||
default: false,
|
||||
},
|
||||
];
|
||||
const options = Object.entries(defaultParameters).map(([key, value]) => ({
|
||||
key: key as keyof SanitizeParameters,
|
||||
label: t(`sanitize.options.${key}`, key),
|
||||
description: t(`sanitize.options.${key}.desc`, `${key} from the PDF`),
|
||||
default: value,
|
||||
}));
|
||||
|
||||
return (
|
||||
<Stack gap="md">
|
||||
|
Loading…
Reference in New Issue
Block a user