diff --git a/frontend/src/components/pageEditor/PageThumbnail.tsx b/frontend/src/components/pageEditor/PageThumbnail.tsx index e988b1557..500c7d08f 100644 --- a/frontend/src/components/pageEditor/PageThumbnail.tsx +++ b/frontend/src/components/pageEditor/PageThumbnail.tsx @@ -231,10 +231,10 @@ const PageThumbnail: React.FC = ({ const handleInsertFileAfter = useCallback((e: React.MouseEvent) => { e.stopPropagation(); - + if (onInsertFiles) { // Open file manager modal with custom handler for page insertion - openFilesModal({ + openFilesModal({ insertAfterPage: page.pageNumber, customHandler: (files: File[], insertAfterPage?: number) => { if (insertAfterPage !== undefined) { @@ -364,7 +364,7 @@ const PageThumbnail: React.FC = ({ }} > {page.isBlankPage ? ( -
= ({ size="sm" fw={500} style={{ - color: 'white', // Keep white for page numbers as they have colored backgrounds + color: 'var(--mantine-color-white)', // Use theme token for consistency position: 'absolute', top: 5, left: 5, diff --git a/frontend/src/contexts/FileContext.tsx b/frontend/src/contexts/FileContext.tsx index 285291539..0c4ba2584 100644 --- a/frontend/src/contexts/FileContext.tsx +++ b/frontend/src/contexts/FileContext.tsx @@ -167,7 +167,16 @@ function FileContextInner({ filesRef.current.clear(); dispatch({ type: 'RESET_CONTEXT' }); - // Clear IndexedDB if enabled + // Don't clear IndexedDB automatically - only clear in-memory state + // IndexedDB should only be cleared when explicitly requested by user + }, + clearAllData: async () => { + // First clear all files from memory + lifecycleManager.cleanupAllFiles(); + filesRef.current.clear(); + dispatch({ type: 'RESET_CONTEXT' }); + + // Then clear IndexedDB storage if (indexedDB && enablePersistence) { try { await indexedDB.clearAll(); diff --git a/frontend/src/types/fileContext.ts b/frontend/src/types/fileContext.ts index 653909568..cb5d6566a 100644 --- a/frontend/src/types/fileContext.ts +++ b/frontend/src/types/fileContext.ts @@ -224,6 +224,7 @@ export interface FileContextActions { updateFileRecord: (id: FileId, updates: Partial) => void; reorderFiles: (orderedFileIds: FileId[]) => void; clearAllFiles: () => Promise; + clearAllData: () => Promise; // File pinning pinFile: (file: File) => void;