Remove pages automation fix

This commit is contained in:
Connor Yoh 2025-10-01 16:41:11 +01:00
parent 170784a66c
commit 458fca4e35
2 changed files with 8 additions and 5 deletions

View File

@ -16,16 +16,17 @@ const RemovePagesSettings = ({ parameters, onParameterChange, disabled = false }
// Allow user to type naturally - don't normalize input in real-time
onParameterChange('pageNumbers', value);
};
console.log('Current pageNumbers input:', parameters.pageNumbers, disabled);
// Check if current input is valid
const isValid = validatePageNumbers(parameters.pageNumbers);
const hasValue = parameters.pageNumbers.trim().length > 0;
const isValid = validatePageNumbers(parameters.pageNumbers || '');
const hasValue = (parameters?.pageNumbers?.trim().length ?? 0) > 0;
return (
<Stack gap="md">
<TextInput
label={t('removePages.pageNumbers.label', 'Pages to Remove')}
value={parameters.pageNumbers}
value={parameters.pageNumbers || ''}
onChange={(event) => handlePageNumbersChange(event.currentTarget.value)}
placeholder={t('removePages.pageNumbers.placeholder', 'e.g., 1,3,5-8,10')}
disabled={disabled}

View File

@ -61,6 +61,7 @@ import { cropOperationConfig } from "../hooks/tools/crop/useCropOperation";
import { removeAnnotationsOperationConfig } from "../hooks/tools/removeAnnotations/useRemoveAnnotationsOperation";
import { extractImagesOperationConfig } from "../hooks/tools/extractImages/useExtractImagesOperation";
import { replaceColorOperationConfig } from "../hooks/tools/replaceColor/useReplaceColorOperation";
import { removePagesOperationConfig } from "../hooks/tools/removePages/useRemovePagesOperation";
import CompressSettings from "../components/tools/compress/CompressSettings";
import AddPasswordSettings from "../components/tools/addPassword/AddPasswordSettings";
import RemovePasswordSettings from "../components/tools/removePassword/RemovePasswordSettings";
@ -95,6 +96,7 @@ import CropAutomationSettings from "../components/tools/crop/CropAutomationSetti
import RotateAutomationSettings from "../components/tools/rotate/RotateAutomationSettings";
import SplitAutomationSettings from "../components/tools/split/SplitAutomationSettings";
import AddAttachmentsSettings from "../components/tools/addAttachments/AddAttachmentsSettings";
import RemovePagesSettings from "../components/tools/removePages/RemovePagesSettings";
const showPlaceholderTools = true; // Show all tools; grey out unavailable ones in UI
@ -551,8 +553,8 @@ export function useFlatToolRegistry(): ToolRegistry {
maxFiles: 1,
endpoints: ["remove-pages"],
synonyms: getSynonyms(t, "removePages"),
automationSettings: null, // TODO:: Needs settings
operationConfig: removePagesOperationConfig,
automationSettings: RemovePagesSettings, // TODO:: Needs settings
},
removeBlanks: {
icon: <LocalIcon icon="scan-delete-rounded" width="1.5rem" height="1.5rem" />,