setup i18n and ported all tools to standalone pages
This commit is contained in:
@@ -23,23 +23,13 @@ import * as pdfjsLib from 'pdfjs-dist';
|
||||
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.mjs', import.meta.url).toString();
|
||||
|
||||
// Re-export rotation state utilities
|
||||
export { getRotationState, updateRotationState, resetRotationState, initializeRotationState } from '../utils/rotation-state.js';
|
||||
|
||||
const rotationState: number[] = [];
|
||||
let imageSortableInstance: Sortable | null = null;
|
||||
const activeImageUrls = new Map<File, string>();
|
||||
|
||||
export function getRotationState(): readonly number[] {
|
||||
return rotationState;
|
||||
}
|
||||
|
||||
export function updateRotationState(pageIndex: number, rotation: number) {
|
||||
if (pageIndex >= 0 && pageIndex < rotationState.length) {
|
||||
rotationState[pageIndex] = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
export function resetRotationState() {
|
||||
rotationState.length = 0;
|
||||
}
|
||||
|
||||
async function handleSinglePdfUpload(toolId, file) {
|
||||
showLoader('Loading PDF...');
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
import { state } from '../state.js';
|
||||
import { dom, switchView, toolTemplates } from '../ui.js';
|
||||
import { setupFileInputHandler } from './fileHandler.js';
|
||||
import { toolLogic } from '../logic/index.js';
|
||||
import { createIcons, icons } from 'lucide';
|
||||
|
||||
const SETUP_AFTER_UPLOAD = ['sign-pdf'];
|
||||
|
||||
export function setupToolInterface(toolId: any) {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'instant' as ScrollBehavior,
|
||||
});
|
||||
|
||||
state.activeTool = toolId;
|
||||
dom.toolContent.innerHTML = toolTemplates[toolId]();
|
||||
createIcons({ icons });
|
||||
switchView('tool');
|
||||
|
||||
const fileInput = document.getElementById('file-input');
|
||||
const processBtn = document.getElementById('process-btn');
|
||||
|
||||
if (!fileInput && processBtn) {
|
||||
const logic = toolLogic[toolId];
|
||||
if (logic) {
|
||||
const func = typeof logic.process === 'function' ? logic.process : logic;
|
||||
processBtn.onclick = func;
|
||||
}
|
||||
}
|
||||
|
||||
if (toolLogic[toolId] && typeof toolLogic[toolId].setup === 'function') {
|
||||
if (!SETUP_AFTER_UPLOAD.includes(toolId)) {
|
||||
toolLogic[toolId].setup();
|
||||
}
|
||||
}
|
||||
|
||||
if (fileInput) {
|
||||
setupFileInputHandler(toolId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user