setup i18n and ported all tools to standalone pages
This commit is contained in:
@@ -14,10 +14,10 @@ export function applyFullWidthMode(enabled: boolean) {
|
||||
const pageUploaders = document.querySelectorAll('#tool-uploader');
|
||||
pageUploaders.forEach((uploader) => {
|
||||
if (enabled) {
|
||||
uploader.classList.remove('max-w-2xl', 'max-w-5xl');
|
||||
uploader.classList.remove('max-w-2xl', 'max-w-4xl', 'max-w-5xl');
|
||||
} else {
|
||||
// Restore original max-width if not already present
|
||||
if (!uploader.classList.contains('max-w-2xl') && !uploader.classList.contains('max-w-5xl')) {
|
||||
if (!uploader.classList.contains('max-w-2xl') && !uploader.classList.contains('max-w-4xl') && !uploader.classList.contains('max-w-5xl')) {
|
||||
uploader.classList.add('max-w-2xl');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export const formatBytes = (bytes: any, decimals = 1) => {
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
};
|
||||
|
||||
export const downloadFile = (blob: any, filename: any) => {
|
||||
export const downloadFile = (blob: Blob, filename: string): void => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
@@ -89,12 +89,12 @@ export const readFileAsArrayBuffer = (file: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
export function parsePageRanges(rangeString: any, totalPages: any) {
|
||||
export function parsePageRanges(rangeString: string, totalPages: number): number[] {
|
||||
if (!rangeString || rangeString.trim() === '') {
|
||||
return Array.from({ length: totalPages }, (_, i) => i);
|
||||
}
|
||||
|
||||
const indices = new Set();
|
||||
const indices = new Set<number>();
|
||||
const parts = rangeString.split(',');
|
||||
|
||||
for (const part of parts) {
|
||||
@@ -128,10 +128,11 @@ export function parsePageRanges(rangeString: any, totalPages: any) {
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error TS(2362) FIXME: The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
|
||||
|
||||
return Array.from(indices).sort((a, b) => a - b);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Formats an ISO 8601 date string (e.g., "2008-02-21T17:15:56-08:00")
|
||||
* into a localized, human-readable string.
|
||||
|
||||
23
src/js/utils/rotation-state.ts
Normal file
23
src/js/utils/rotation-state.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// Rotation state management for PDF pages
|
||||
const rotationState: number[] = [];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
export function initializeRotationState(pageCount: number) {
|
||||
rotationState.length = 0;
|
||||
for (let i = 0; i < pageCount; i++) {
|
||||
rotationState.push(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user