mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-26 14:19:24 +00:00
File editor clean up and fix infinite loop
This commit is contained in:
parent
46a55b2c95
commit
cbaa945b7e
@ -6,7 +6,7 @@ import {
|
|||||||
import { Dropzone } from '@mantine/dropzone';
|
import { Dropzone } from '@mantine/dropzone';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import UploadFileIcon from '@mui/icons-material/UploadFile';
|
import UploadFileIcon from '@mui/icons-material/UploadFile';
|
||||||
import { useToolFileSelection, useFileState, useFileManagement, useFileActions } from '../../contexts/FileContext';
|
import { useFileSelection, useFileState, useFileManagement, useFileActions } from '../../contexts/FileContext';
|
||||||
import { useNavigationActions } from '../../contexts/NavigationContext';
|
import { useNavigationActions } from '../../contexts/NavigationContext';
|
||||||
import { FileOperation } from '../../types/fileContext';
|
import { FileOperation } from '../../types/fileContext';
|
||||||
import { fileStorage } from '../../services/fileStorage';
|
import { fileStorage } from '../../services/fileStorage';
|
||||||
@ -58,26 +58,8 @@ const FileEditor = ({
|
|||||||
const { actions } = useFileActions();
|
const { actions } = useFileActions();
|
||||||
const { actions: navActions } = useNavigationActions();
|
const { actions: navActions } = useNavigationActions();
|
||||||
|
|
||||||
// Proper context-based file selection updater
|
// Get file selection context
|
||||||
const setContextSelectedFiles = useCallback((fileIds: string[] | ((prev: string[]) => string[])) => {
|
const { setSelectedFiles } = useFileSelection();
|
||||||
if (typeof fileIds === 'function') {
|
|
||||||
// Handle callback pattern with current state
|
|
||||||
const result = fileIds(selectedFileIds);
|
|
||||||
actions.setSelectedFiles(result);
|
|
||||||
} else {
|
|
||||||
// Handle direct array pattern
|
|
||||||
actions.setSelectedFiles(fileIds);
|
|
||||||
}
|
|
||||||
}, [selectedFileIds, actions.setSelectedFiles]);
|
|
||||||
|
|
||||||
|
|
||||||
// Get tool file selection context (replaces FileSelectionContext)
|
|
||||||
const {
|
|
||||||
selectedFiles: toolSelectedFiles,
|
|
||||||
setSelectedFiles: setToolSelectedFiles,
|
|
||||||
maxFiles,
|
|
||||||
isToolMode
|
|
||||||
} = useToolFileSelection();
|
|
||||||
|
|
||||||
const [status, setStatus] = useState<string | null>(null);
|
const [status, setStatus] = useState<string | null>(null);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
@ -271,10 +253,10 @@ const FileEditor = ({
|
|||||||
}, [addFiles]);
|
}, [addFiles]);
|
||||||
|
|
||||||
const selectAll = useCallback(() => {
|
const selectAll = useCallback(() => {
|
||||||
setContextSelectedFiles(activeFileRecords.map(r => r.id)); // Use FileRecord IDs directly
|
setSelectedFiles(activeFileRecords.map(r => r.id)); // Use FileRecord IDs directly
|
||||||
}, [activeFileRecords, setContextSelectedFiles]);
|
}, [activeFileRecords, setSelectedFiles]);
|
||||||
|
|
||||||
const deselectAll = useCallback(() => setContextSelectedFiles([]), [setContextSelectedFiles]);
|
const deselectAll = useCallback(() => setSelectedFiles([]), [setSelectedFiles]);
|
||||||
|
|
||||||
const closeAllFiles = useCallback(() => {
|
const closeAllFiles = useCallback(() => {
|
||||||
if (activeFileRecords.length === 0) return;
|
if (activeFileRecords.length === 0) return;
|
||||||
@ -284,8 +266,8 @@ const FileEditor = ({
|
|||||||
removeFiles(allFileIds, false); // false = keep in storage
|
removeFiles(allFileIds, false); // false = keep in storage
|
||||||
|
|
||||||
// Clear selections
|
// Clear selections
|
||||||
setContextSelectedFiles([]);
|
setSelectedFiles([]);
|
||||||
}, [activeFileRecords, removeFiles, setContextSelectedFiles]);
|
}, [activeFileRecords, removeFiles, setSelectedFiles]);
|
||||||
|
|
||||||
const toggleFile = useCallback((fileId: string) => {
|
const toggleFile = useCallback((fileId: string) => {
|
||||||
const currentSelectedIds = contextSelectedIdsRef.current;
|
const currentSelectedIds = contextSelectedIdsRef.current;
|
||||||
@ -303,36 +285,34 @@ const FileEditor = ({
|
|||||||
newSelection = currentSelectedIds.filter(id => id !== contextFileId);
|
newSelection = currentSelectedIds.filter(id => id !== contextFileId);
|
||||||
} else {
|
} else {
|
||||||
// Add file to selection
|
// Add file to selection
|
||||||
if (maxFiles === 1) {
|
// In tool mode, typically allow multiple files unless specified otherwise
|
||||||
|
const maxAllowed = toolMode ? 10 : Infinity; // Default max for tools
|
||||||
|
|
||||||
|
if (maxAllowed === 1) {
|
||||||
newSelection = [contextFileId];
|
newSelection = [contextFileId];
|
||||||
} else {
|
} else {
|
||||||
// Check if we've hit the selection limit
|
// Check if we've hit the selection limit
|
||||||
if (maxFiles > 1 && currentSelectedIds.length >= maxFiles) {
|
if (maxAllowed > 1 && currentSelectedIds.length >= maxAllowed) {
|
||||||
setStatus(`Maximum ${maxFiles} files can be selected`);
|
setStatus(`Maximum ${maxAllowed} files can be selected`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newSelection = [...currentSelectedIds, contextFileId];
|
newSelection = [...currentSelectedIds, contextFileId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update context
|
// Update context (this automatically updates tool selection since they use the same action)
|
||||||
setContextSelectedFiles(newSelection);
|
setSelectedFiles(newSelection);
|
||||||
|
}, [setSelectedFiles, toolMode, setStatus, activeFileRecords]);
|
||||||
// Update tool selection context if in tool mode
|
|
||||||
if (isToolMode || toolMode) {
|
|
||||||
setToolSelectedFiles(newSelection);
|
|
||||||
}
|
|
||||||
}, [setContextSelectedFiles, maxFiles, setStatus, isToolMode, toolMode, setToolSelectedFiles, activeFileRecords]);
|
|
||||||
|
|
||||||
const toggleSelectionMode = useCallback(() => {
|
const toggleSelectionMode = useCallback(() => {
|
||||||
setSelectionMode(prev => {
|
setSelectionMode(prev => {
|
||||||
const newMode = !prev;
|
const newMode = !prev;
|
||||||
if (!newMode) {
|
if (!newMode) {
|
||||||
setContextSelectedFiles([]);
|
setSelectedFiles([]);
|
||||||
}
|
}
|
||||||
return newMode;
|
return newMode;
|
||||||
});
|
});
|
||||||
}, [setContextSelectedFiles]);
|
}, [setSelectedFiles]);
|
||||||
|
|
||||||
// File reordering handler for drag and drop
|
// File reordering handler for drag and drop
|
||||||
const handleReorderFiles = useCallback((sourceFileId: string, targetFileId: string, selectedFileIds: string[]) => {
|
const handleReorderFiles = useCallback((sourceFileId: string, targetFileId: string, selectedFileIds: string[]) => {
|
||||||
@ -422,21 +402,19 @@ const FileEditor = ({
|
|||||||
removeFiles([contextFileId], false);
|
removeFiles([contextFileId], false);
|
||||||
|
|
||||||
// Remove from context selections
|
// Remove from context selections
|
||||||
setContextSelectedFiles((prev: string[]) => {
|
const currentSelected = selectedFileIds.filter(id => id !== contextFileId);
|
||||||
const safePrev = Array.isArray(prev) ? prev : [];
|
setSelectedFiles(currentSelected);
|
||||||
return safePrev.filter(id => id !== contextFileId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, [activeFileRecords, selectors, removeFiles, setContextSelectedFiles]);
|
}, [activeFileRecords, selectors, removeFiles, setSelectedFiles, selectedFileIds]);
|
||||||
|
|
||||||
const handleViewFile = useCallback((fileId: string) => {
|
const handleViewFile = useCallback((fileId: string) => {
|
||||||
const record = activeFileRecords.find(r => r.id === fileId);
|
const record = activeFileRecords.find(r => r.id === fileId);
|
||||||
if (record) {
|
if (record) {
|
||||||
// Set the file as selected in context and switch to viewer for preview
|
// Set the file as selected in context and switch to viewer for preview
|
||||||
setContextSelectedFiles([fileId]);
|
setSelectedFiles([fileId]);
|
||||||
navActions.setMode('viewer');
|
navActions.setMode('viewer');
|
||||||
}
|
}
|
||||||
}, [activeFileRecords, setContextSelectedFiles, navActions.setMode]);
|
}, [activeFileRecords, setSelectedFiles, navActions.setMode]);
|
||||||
|
|
||||||
const handleMergeFromHere = useCallback((fileId: string) => {
|
const handleMergeFromHere = useCallback((fileId: string) => {
|
||||||
const startIndex = activeFileRecords.findIndex(r => r.id === fileId);
|
const startIndex = activeFileRecords.findIndex(r => r.id === fileId);
|
||||||
|
@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useMultipleEndpointsEnabled } from "../../../hooks/useEndpointConfig";
|
import { useMultipleEndpointsEnabled } from "../../../hooks/useEndpointConfig";
|
||||||
import { isImageFormat, isWebFormat } from "../../../utils/convertUtils";
|
import { isImageFormat, isWebFormat } from "../../../utils/convertUtils";
|
||||||
import { getConversionEndpoints } from "../../../data/toolsTaxonomy";
|
import { getConversionEndpoints } from "../../../data/toolsTaxonomy";
|
||||||
import { useToolFileSelection } from "../../../contexts/FileContext";
|
import { useFileSelection } from "../../../contexts/FileContext";
|
||||||
import { useFileState } from "../../../contexts/FileContext";
|
import { useFileState } from "../../../contexts/FileContext";
|
||||||
import { detectFileExtension } from "../../../utils/fileUtils";
|
import { detectFileExtension } from "../../../utils/fileUtils";
|
||||||
import GroupedFormatDropdown from "./GroupedFormatDropdown";
|
import GroupedFormatDropdown from "./GroupedFormatDropdown";
|
||||||
@ -41,7 +41,7 @@ const ConvertSettings = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useMantineTheme();
|
const theme = useMantineTheme();
|
||||||
const { colorScheme } = useMantineColorScheme();
|
const { colorScheme } = useMantineColorScheme();
|
||||||
const { setSelectedFiles } = useToolFileSelection();
|
const { setSelectedFiles } = useFileSelection();
|
||||||
const { state, selectors } = useFileState();
|
const { state, selectors } = useFileState();
|
||||||
const activeFiles = state.files.ids;
|
const activeFiles = state.files.ids;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Key hooks:
|
* Key hooks:
|
||||||
* - useFileState() - access file state and UI state
|
* - useFileState() - access file state and UI state
|
||||||
* - useFileActions() - file operations (add/remove/update)
|
* - useFileActions() - file operations (add/remove/update)
|
||||||
* - useToolFileSelection() - for tool components
|
* - useFileSelection() - for file selection state and actions
|
||||||
*
|
*
|
||||||
* Memory management handled by FileLifecycleManager (PDF.js cleanup, blob URL revocation).
|
* Memory management handled by FileLifecycleManager (PDF.js cleanup, blob URL revocation).
|
||||||
*/
|
*/
|
||||||
@ -275,6 +275,5 @@ export {
|
|||||||
useAllFiles,
|
useAllFiles,
|
||||||
useSelectedFiles,
|
useSelectedFiles,
|
||||||
// Primary API hooks for tools
|
// Primary API hooks for tools
|
||||||
useFileContext,
|
useFileContext
|
||||||
useToolFileSelection
|
|
||||||
} from './file/fileHooks';
|
} from './file/fileHooks';
|
@ -51,16 +51,23 @@ export function useCurrentFile(): { file?: File; record?: FileRecord } {
|
|||||||
* Hook for file selection state and actions
|
* Hook for file selection state and actions
|
||||||
*/
|
*/
|
||||||
export function useFileSelection() {
|
export function useFileSelection() {
|
||||||
const { state } = useFileState();
|
const { state, selectors } = useFileState();
|
||||||
const { actions } = useFileActions();
|
const { actions } = useFileActions();
|
||||||
|
|
||||||
|
// Memoize selected files to avoid recreating arrays
|
||||||
|
const selectedFiles = useMemo(() => {
|
||||||
|
return selectors.getSelectedFiles();
|
||||||
|
}, [state.ui.selectedFileIds, selectors]);
|
||||||
|
|
||||||
return useMemo(() => ({
|
return useMemo(() => ({
|
||||||
|
selectedFiles,
|
||||||
selectedFileIds: state.ui.selectedFileIds,
|
selectedFileIds: state.ui.selectedFileIds,
|
||||||
selectedPageNumbers: state.ui.selectedPageNumbers,
|
selectedPageNumbers: state.ui.selectedPageNumbers,
|
||||||
setSelectedFiles: actions.setSelectedFiles,
|
setSelectedFiles: actions.setSelectedFiles,
|
||||||
setSelectedPages: actions.setSelectedPages,
|
setSelectedPages: actions.setSelectedPages,
|
||||||
clearSelections: actions.clearSelections
|
clearSelections: actions.clearSelections
|
||||||
}), [
|
}), [
|
||||||
|
selectedFiles,
|
||||||
state.ui.selectedFileIds,
|
state.ui.selectedFileIds,
|
||||||
state.ui.selectedPageNumbers,
|
state.ui.selectedPageNumbers,
|
||||||
actions.setSelectedFiles,
|
actions.setSelectedFiles,
|
||||||
@ -183,38 +190,4 @@ export function useFileContext() {
|
|||||||
}), [state, selectors, actions]);
|
}), [state, selectors, actions]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary API hook for tool file selection workflow
|
|
||||||
* Used by tools for managing file selection and tool-specific operations
|
|
||||||
*/
|
|
||||||
export function useToolFileSelection() {
|
|
||||||
const { state, selectors } = useFileState();
|
|
||||||
const { actions } = useFileActions();
|
|
||||||
|
|
||||||
// Memoize selected files to avoid recreating arrays
|
|
||||||
const selectedFiles = useMemo(() => {
|
|
||||||
return selectors.getSelectedFiles();
|
|
||||||
}, [state.ui.selectedFileIds, selectors]);
|
|
||||||
|
|
||||||
return useMemo(() => ({
|
|
||||||
selectedFiles,
|
|
||||||
selectedFileIds: state.ui.selectedFileIds,
|
|
||||||
selectedPageNumbers: state.ui.selectedPageNumbers,
|
|
||||||
setSelectedFiles: actions.setSelectedFiles,
|
|
||||||
setSelectedPages: actions.setSelectedPages,
|
|
||||||
clearSelections: actions.clearSelections,
|
|
||||||
// Tool workflow properties
|
|
||||||
maxFiles: 10, // Default value for tools
|
|
||||||
isToolMode: true,
|
|
||||||
setMaxFiles: (maxFiles: number) => { /* Tool-specific - can be implemented if needed */ },
|
|
||||||
setIsToolMode: (isToolMode: boolean) => { /* Tool-specific - can be implemented if needed */ }
|
|
||||||
}), [
|
|
||||||
selectedFiles,
|
|
||||||
state.ui.selectedFileIds,
|
|
||||||
state.ui.selectedPageNumbers,
|
|
||||||
actions.setSelectedFiles,
|
|
||||||
actions.setSelectedPages,
|
|
||||||
actions.clearSelections
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import { getEndpointName as getEndpointNameUtil, getEndpointUrl, isImageFormat,
|
|||||||
import { detectFileExtension as detectFileExtensionUtil } from '../../../utils/fileUtils';
|
import { detectFileExtension as detectFileExtensionUtil } from '../../../utils/fileUtils';
|
||||||
import { BaseParameters } from '../../../types/parameters';
|
import { BaseParameters } from '../../../types/parameters';
|
||||||
import { useBaseParameters, BaseParametersHook } from '../shared/useBaseParameters';
|
import { useBaseParameters, BaseParametersHook } from '../shared/useBaseParameters';
|
||||||
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
export interface ConvertParameters extends BaseParameters {
|
export interface ConvertParameters extends BaseParameters {
|
||||||
fromExtension: string;
|
fromExtension: string;
|
||||||
@ -121,11 +122,13 @@ const getEndpointName = (params: ConvertParameters): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useConvertParameters = (): ConvertParametersHook => {
|
export const useConvertParameters = (): ConvertParametersHook => {
|
||||||
const baseHook = useBaseParameters({
|
const config = useMemo(() => ({
|
||||||
defaultParameters,
|
defaultParameters,
|
||||||
endpointName: getEndpointName,
|
endpointName: getEndpointName,
|
||||||
validateFn: validateParameters,
|
validateFn: validateParameters,
|
||||||
});
|
}), []);
|
||||||
|
|
||||||
|
const baseHook = useBaseParameters(config);
|
||||||
|
|
||||||
const getEndpoint = () => {
|
const getEndpoint = () => {
|
||||||
const { fromExtension, toExtension, isSmartDetection, smartDetectionType } = baseHook.parameters;
|
const { fromExtension, toExtension, isSmartDetection, smartDetectionType } = baseHook.parameters;
|
||||||
@ -178,15 +181,22 @@ export const useConvertParameters = (): ConvertParametersHook => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const analyzeFileTypes = (files: Array<{name: string}>) => {
|
const analyzeFileTypes = useCallback((files: Array<{name: string}>) => {
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
// No files - only reset smart detection, keep user's format choices
|
// No files - only reset smart detection, keep user's format choices
|
||||||
baseHook.setParameters(prev => ({
|
baseHook.setParameters(prev => {
|
||||||
|
// Only update if something actually changed
|
||||||
|
if (prev.isSmartDetection === false && prev.smartDetectionType === 'none') {
|
||||||
|
return prev; // No change needed
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
isSmartDetection: false,
|
isSmartDetection: false,
|
||||||
smartDetectionType: 'none'
|
smartDetectionType: 'none'
|
||||||
// Don't reset fromExtension and toExtension - let user keep their choices
|
// Don't reset fromExtension and toExtension - let user keep their choices
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,13 +231,25 @@ export const useConvertParameters = (): ConvertParametersHook => {
|
|||||||
newToExtension = availableTargets.length === 1 ? availableTargets[0] : '';
|
newToExtension = availableTargets.length === 1 ? availableTargets[0] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const newState = {
|
||||||
...prev,
|
...prev,
|
||||||
isSmartDetection: false,
|
isSmartDetection: false,
|
||||||
smartDetectionType: 'none',
|
smartDetectionType: 'none' as const,
|
||||||
fromExtension: fromExt,
|
fromExtension: fromExt,
|
||||||
toExtension: newToExtension
|
toExtension: newToExtension
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only update if something actually changed
|
||||||
|
if (
|
||||||
|
prev.isSmartDetection === newState.isSmartDetection &&
|
||||||
|
prev.smartDetectionType === newState.smartDetectionType &&
|
||||||
|
prev.fromExtension === newState.fromExtension &&
|
||||||
|
prev.toExtension === newState.toExtension
|
||||||
|
) {
|
||||||
|
return prev; // Return the same object to prevent re-render
|
||||||
|
}
|
||||||
|
|
||||||
|
return newState;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -262,13 +284,25 @@ export const useConvertParameters = (): ConvertParametersHook => {
|
|||||||
newToExtension = availableTargets.length === 1 ? availableTargets[0] : '';
|
newToExtension = availableTargets.length === 1 ? availableTargets[0] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const newState = {
|
||||||
...prev,
|
...prev,
|
||||||
isSmartDetection: false,
|
isSmartDetection: false,
|
||||||
smartDetectionType: 'none',
|
smartDetectionType: 'none' as const,
|
||||||
fromExtension: fromExt,
|
fromExtension: fromExt,
|
||||||
toExtension: newToExtension
|
toExtension: newToExtension
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only update if something actually changed
|
||||||
|
if (
|
||||||
|
prev.isSmartDetection === newState.isSmartDetection &&
|
||||||
|
prev.smartDetectionType === newState.smartDetectionType &&
|
||||||
|
prev.fromExtension === newState.fromExtension &&
|
||||||
|
prev.toExtension === newState.toExtension
|
||||||
|
) {
|
||||||
|
return prev; // Return the same object to prevent re-render
|
||||||
|
}
|
||||||
|
|
||||||
|
return newState;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Mixed file types
|
// Mixed file types
|
||||||
@ -277,34 +311,64 @@ export const useConvertParameters = (): ConvertParametersHook => {
|
|||||||
|
|
||||||
if (allImages) {
|
if (allImages) {
|
||||||
// All files are images - use image-to-pdf conversion
|
// All files are images - use image-to-pdf conversion
|
||||||
baseHook.setParameters(prev => ({
|
baseHook.setParameters(prev => {
|
||||||
|
// Only update if something actually changed
|
||||||
|
if (prev.isSmartDetection === true &&
|
||||||
|
prev.smartDetectionType === 'images' &&
|
||||||
|
prev.fromExtension === 'image' &&
|
||||||
|
prev.toExtension === 'pdf') {
|
||||||
|
return prev; // No change needed
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
isSmartDetection: true,
|
isSmartDetection: true,
|
||||||
smartDetectionType: 'images',
|
smartDetectionType: 'images',
|
||||||
fromExtension: 'image',
|
fromExtension: 'image',
|
||||||
toExtension: 'pdf'
|
toExtension: 'pdf'
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
} else if (allWeb) {
|
} else if (allWeb) {
|
||||||
// All files are web files - use html-to-pdf conversion
|
// All files are web files - use html-to-pdf conversion
|
||||||
baseHook.setParameters(prev => ({
|
baseHook.setParameters(prev => {
|
||||||
|
// Only update if something actually changed
|
||||||
|
if (prev.isSmartDetection === true &&
|
||||||
|
prev.smartDetectionType === 'web' &&
|
||||||
|
prev.fromExtension === 'html' &&
|
||||||
|
prev.toExtension === 'pdf') {
|
||||||
|
return prev; // No change needed
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
isSmartDetection: true,
|
isSmartDetection: true,
|
||||||
smartDetectionType: 'web',
|
smartDetectionType: 'web',
|
||||||
fromExtension: 'html',
|
fromExtension: 'html',
|
||||||
toExtension: 'pdf'
|
toExtension: 'pdf'
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// Mixed non-image types - use file-to-pdf conversion
|
// Mixed non-image types - use file-to-pdf conversion
|
||||||
baseHook.setParameters(prev => ({
|
baseHook.setParameters(prev => {
|
||||||
|
// Only update if something actually changed
|
||||||
|
if (prev.isSmartDetection === true &&
|
||||||
|
prev.smartDetectionType === 'mixed' &&
|
||||||
|
prev.fromExtension === 'any' &&
|
||||||
|
prev.toExtension === 'pdf') {
|
||||||
|
return prev; // No change needed
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
isSmartDetection: true,
|
isSmartDetection: true,
|
||||||
smartDetectionType: 'mixed',
|
smartDetectionType: 'mixed',
|
||||||
fromExtension: 'any',
|
fromExtension: 'any',
|
||||||
toExtension: 'pdf'
|
toExtension: 'pdf'
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [baseHook.setParameters]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...baseHook,
|
...baseHook,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useFileActions, useToolFileSelection } from "../contexts/FileContext";
|
import { useFileActions, useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
import { ToolWorkflowProvider, useToolWorkflow } from "../contexts/ToolWorkflowContext";
|
import { ToolWorkflowProvider, useToolWorkflow } from "../contexts/ToolWorkflowContext";
|
||||||
import { Group } from "@mantine/core";
|
import { Group } from "@mantine/core";
|
||||||
@ -22,7 +22,7 @@ function HomePageContent() {
|
|||||||
|
|
||||||
const { quickAccessRef } = sidebarRefs;
|
const { quickAccessRef } = sidebarRefs;
|
||||||
|
|
||||||
const { setMaxFiles, setIsToolMode, setSelectedFiles } = useToolFileSelection();
|
const { setSelectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const { selectedTool, selectedToolKey } = useToolWorkflow();
|
const { selectedTool, selectedToolKey } = useToolWorkflow();
|
||||||
|
|
||||||
@ -38,17 +38,7 @@ function HomePageContent() {
|
|||||||
ogUrl: selectedTool ? `${baseUrl}${window.location.pathname}` : baseUrl
|
ogUrl: selectedTool ? `${baseUrl}${window.location.pathname}` : baseUrl
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update file selection context when tool changes
|
// Note: File selection limits are now handled directly by individual tools
|
||||||
useEffect(() => {
|
|
||||||
if (selectedTool) {
|
|
||||||
setMaxFiles(selectedTool.maxFiles ?? -1);
|
|
||||||
setIsToolMode(true);
|
|
||||||
} else {
|
|
||||||
setMaxFiles(-1);
|
|
||||||
setIsToolMode(false);
|
|
||||||
// Don't clear selections when exiting tool mode - preserve selections for file/page editor
|
|
||||||
}
|
|
||||||
}, [selectedTool]); // Remove action dependencies to prevent loops
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group
|
<Group
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -18,7 +18,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const AddPassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const AddPassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const [collapsedPermissions, setCollapsedPermissions] = useState(true);
|
const [collapsedPermissions, setCollapsedPermissions] = useState(true);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -26,7 +26,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const AddWatermark = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const AddWatermark = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const [collapsedType, setCollapsedType] = useState(false);
|
const [collapsedType, setCollapsedType] = useState(false);
|
||||||
const [collapsedStyle, setCollapsedStyle] = useState(true);
|
const [collapsedStyle, setCollapsedStyle] = useState(true);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -16,7 +16,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const ChangePermissions = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const ChangePermissions = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const changePermissionsParams = useChangePermissionsParameters();
|
const changePermissionsParams = useChangePermissionsParameters();
|
||||||
const changePermissionsOperation = useChangePermissionsOperation();
|
const changePermissionsOperation = useChangePermissionsOperation();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -16,7 +16,7 @@ import { useCompressTips } from "../components/tooltips/useCompressTips";
|
|||||||
const Compress = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const Compress = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const compressParams = useCompressParameters();
|
const compressParams = useCompressParameters();
|
||||||
const compressOperation = useCompressOperation();
|
const compressOperation = useCompressOperation();
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import React, { useEffect, useRef } from "react";
|
import React, { useEffect, useRef } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useFileState } from "../contexts/FileContext";
|
import { useFileState, useFileSelection } from "../contexts/FileContext";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -18,7 +17,7 @@ const Convert = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
|||||||
const { selectors } = useFileState();
|
const { selectors } = useFileState();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const activeFiles = selectors.getFiles();
|
const activeFiles = selectors.getFiles();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const convertParams = useConvertParameters();
|
const convertParams = useConvertParameters();
|
||||||
@ -49,7 +48,7 @@ const Convert = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
|||||||
convertParams.resetParameters();
|
convertParams.resetParameters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedFiles, activeFiles]);
|
}, [selectedFiles, activeFiles, convertParams.analyzeFileTypes, convertParams.resetParameters]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Only clear results if we're not currently processing and parameters changed
|
// Only clear results if we're not currently processing and parameters changed
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -17,7 +17,7 @@ import { useOCRTips } from "../components/tooltips/useOCRTips";
|
|||||||
const OCR = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const OCR = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const ocrParams = useOCRParameters();
|
const ocrParams = useOCRParameters();
|
||||||
const ocrOperation = useOCROperation();
|
const ocrOperation = useOCROperation();
|
||||||
|
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useFileContext } from "../contexts/FileContext";
|
import { useFileContext } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
import { useToolFileSelection } from "../contexts/file/fileHooks";
|
import { useFileSelection } from "../contexts/file/fileHooks";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const RemoveCertificateSign = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const RemoveCertificateSign = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const removeCertificateSignParams = useRemoveCertificateSignParameters();
|
const removeCertificateSignParams = useRemoveCertificateSignParameters();
|
||||||
const removeCertificateSignOperation = useRemoveCertificateSignOperation();
|
const removeCertificateSignOperation = useRemoveCertificateSignOperation();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -16,7 +16,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const RemovePassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const RemovePassword = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const removePasswordParams = useRemovePasswordParameters();
|
const removePasswordParams = useRemovePasswordParameters();
|
||||||
const removePasswordOperation = useRemovePasswordOperation();
|
const removePasswordOperation = useRemovePasswordOperation();
|
||||||
|
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useFileContext } from "../contexts/FileContext";
|
import { useFileContext } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
import { useToolFileSelection } from "../contexts/file/fileHooks";
|
import { useFileSelection } from "../contexts/file/fileHooks";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const Repair = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const Repair = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const repairParams = useRepairParameters();
|
const repairParams = useRepairParameters();
|
||||||
const repairOperation = useRepairOperation();
|
const repairOperation = useRepairOperation();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -14,7 +14,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const Sanitize = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const Sanitize = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
|
|
||||||
const sanitizeParams = useSanitizeParameters();
|
const sanitizeParams = useSanitizeParameters();
|
||||||
|
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useFileContext } from "../contexts/FileContext";
|
import { useFileContext } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
import { useToolFileSelection } from "../contexts/file/fileHooks";
|
import { useFileSelection } from "../contexts/file/fileHooks";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const SingleLargePage = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const SingleLargePage = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const singleLargePageParams = useSingleLargePageParameters();
|
const singleLargePageParams = useSingleLargePageParameters();
|
||||||
const singleLargePageOperation = useSingleLargePageOperation();
|
const singleLargePageOperation = useSingleLargePageOperation();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useToolFileSelection } from "../contexts/FileContext";
|
import { useFileSelection } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
@ -14,7 +14,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const Split = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const Split = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const splitParams = useSplitParameters();
|
const splitParams = useSplitParameters();
|
||||||
const splitOperation = useSplitOperation();
|
const splitOperation = useSplitOperation();
|
||||||
|
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
import { useEndpointEnabled } from "../hooks/useEndpointConfig";
|
||||||
import { useFileContext } from "../contexts/FileContext";
|
import { useFileContext } from "../contexts/FileContext";
|
||||||
import { useNavigationActions } from "../contexts/NavigationContext";
|
import { useNavigationActions } from "../contexts/NavigationContext";
|
||||||
import { useToolFileSelection } from "../contexts/file/fileHooks";
|
import { useFileSelection } from "../contexts/file/fileHooks";
|
||||||
|
|
||||||
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
import { createToolFlow } from "../components/tools/shared/createToolFlow";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import { BaseToolProps } from "../types/tool";
|
|||||||
const UnlockPdfForms = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
const UnlockPdfForms = ({ onPreviewFile, onComplete, onError }: BaseToolProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actions } = useNavigationActions();
|
const { actions } = useNavigationActions();
|
||||||
const { selectedFiles } = useToolFileSelection();
|
const { selectedFiles } = useFileSelection();
|
||||||
|
|
||||||
const unlockPdfFormsParams = useUnlockPdfFormsParameters();
|
const unlockPdfFormsParams = useUnlockPdfFormsParameters();
|
||||||
const unlockPdfFormsOperation = useUnlockPdfFormsOperation();
|
const unlockPdfFormsOperation = useUnlockPdfFormsOperation();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user