Add password prompt functionality and tests while uploading encrypted PDF

This commit is contained in:
alam00000 committed 2026-03-26 12:11:12 +05:30
1 parent f88f872162
commit 1dbf907eeb
79 files changed
+7869 -4419

No files matched your search

+6 -2
View File
@@ -7,6 +7,7 @@ import {
showWasmRequiredDialog,
WasmProvider,
} from '../utils/wasm-provider.js';
import { loadPdfWithPasswordPrompt } from '../utils/password-prompt.js';
const worker = new Worker(
import.meta.env.BASE_URL + 'workers/edit-attachments.worker.js'
@@ -327,14 +328,17 @@ async function updateUI() {
}
}
function handleFileSelect(files: FileList | null) {
async function handleFileSelect(files: FileList | null) {
if (files && files.length > 0) {
const file = files[0];
if (
file.type === 'application/pdf' ||
file.name.toLowerCase().endsWith('.pdf')
) {
pageState.file = file;
const result = await loadPdfWithPasswordPrompt(file);
if (!result) return;
result.pdf.destroy();
pageState.file = result.file;
updateUI();
}
}