mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-17 13:52:14 +01:00
Fix import warnings
This commit is contained in:
parent
31a653be32
commit
d2d70fe793
@ -1,5 +1,7 @@
|
||||
import { FileId } from '@app/types/file';
|
||||
import { PDFDocument, PDFPage, PageBreakSettings } from '@app/types/pageEditor';
|
||||
import { pdfWorkerManager } from '@app/services/pdfWorkerManager';
|
||||
import { thumbnailGenerationService } from '@app/services/thumbnailGenerationService';
|
||||
|
||||
// V1-style DOM-first command system (replaces the old React state commands)
|
||||
export abstract class DOMCommand {
|
||||
@ -727,8 +729,6 @@ export class InsertFilesCommand extends DOMCommand {
|
||||
|
||||
private async generateThumbnailsForInsertedPages(updatedDocument: PDFDocument): Promise<void> {
|
||||
try {
|
||||
const { thumbnailGenerationService } = await import('@app/services/thumbnailGenerationService');
|
||||
|
||||
// Group pages by file ID to generate thumbnails efficiently
|
||||
const pagesByFileId = new Map<FileId, PDFPage[]>();
|
||||
|
||||
@ -809,7 +809,6 @@ export class InsertFilesCommand extends DOMCommand {
|
||||
const clonedArrayBuffer = arrayBuffer.slice(0);
|
||||
|
||||
// Use PDF.js via the worker manager to extract pages
|
||||
const { pdfWorkerManager } = await import('@app/services/pdfWorkerManager');
|
||||
const pdf = await pdfWorkerManager.createDocument(clonedArrayBuffer);
|
||||
|
||||
const pageCount = pdf.numPages;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Dispatch, SetStateAction, useCallback } from "react";
|
||||
import JSZip from "jszip";
|
||||
|
||||
import type {
|
||||
useFileActions,
|
||||
@ -194,8 +195,7 @@ export const usePageEditorExport = ({
|
||||
);
|
||||
|
||||
if (files.length > 1) {
|
||||
const JSZip = await import("jszip");
|
||||
const zip = new JSZip.default();
|
||||
const zip = new JSZip();
|
||||
|
||||
files.forEach((file) => {
|
||||
zip.file(file.name, file);
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
ProcessedFileMetadata,
|
||||
} from '@app/types/fileContext';
|
||||
import { FileId, ToolOperation } from '@app/types/file';
|
||||
import { generateThumbnailWithMetadata } from '@app/utils/thumbnailUtils';
|
||||
import { generateThumbnailWithMetadata, generateThumbnailForFile } from '@app/utils/thumbnailUtils';
|
||||
import { FileLifecycleManager } from '@app/contexts/file/lifecycle';
|
||||
import { buildQuickKeySet } from '@app/contexts/file/fileSelectors';
|
||||
import { StirlingFile } from '@app/types/fileContext';
|
||||
@ -296,7 +296,6 @@ export async function addFiles(
|
||||
// Non-PDF files: simple thumbnail generation, no processedFile metadata
|
||||
try {
|
||||
if (DEBUG) console.log(`📄 Generating simple thumbnail for non-PDF file ${file.name}`);
|
||||
const { generateThumbnailForFile } = await import('@app/utils/thumbnailUtils');
|
||||
thumbnail = await generateThumbnailForFile(file);
|
||||
if (DEBUG) console.log(`📄 Generated simple thumbnail for ${file.name}: no page count, thumbnail: SUCCESS`);
|
||||
} catch (error) {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import JSZip from 'jszip';
|
||||
import { OCRParameters, defaultParameters } from '@app/hooks/tools/ocr/useOCRParameters';
|
||||
import { useToolOperation, ToolOperationConfig, ToolType } from '@app/hooks/tools/shared/useToolOperation';
|
||||
import { createStandardErrorHandler } from '@app/utils/toolErrorHandler';
|
||||
@ -18,8 +19,7 @@ function getMimeType(filename: string): string {
|
||||
|
||||
// Lightweight ZIP extractor (keep or replace with a shared util if you have one)
|
||||
async function extractZipFile(zipBlob: Blob): Promise<File[]> {
|
||||
const JSZip = await import('jszip');
|
||||
const zip = new JSZip.default();
|
||||
const zip = new JSZip();
|
||||
const zipContent = await zip.loadAsync(await zipBlob.arrayBuffer());
|
||||
const out: File[] = [];
|
||||
for (const [filename, file] of Object.entries(zipContent.files)) {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { invoke, isTauri } from '@tauri-apps/api/core';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
|
||||
export interface FileOpenService {
|
||||
getOpenedFiles(): Promise<string[]>;
|
||||
@ -60,8 +61,6 @@ class TauriFileOpenService implements FileOpenService {
|
||||
|
||||
// Only import if in Tauri environment
|
||||
if (isTauri()) {
|
||||
const { listen } = await import('@tauri-apps/api/event');
|
||||
|
||||
// Check again after async import
|
||||
if (isCleanedUp) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user