debug: 添加下载过程日志
This commit is contained in:
+9
-2
@@ -104,15 +104,22 @@ async function exportPptx() {
|
||||
// 4. 生成 PPTX
|
||||
setProgress(90, '正在打包...');
|
||||
const blob = await WebToPPT.schemaToPptxBlob(schema);
|
||||
console.log('[WebToPPT] blob size:', blob.size, 'type:', blob.type);
|
||||
|
||||
// 5. 下载(弹出保存对话框)
|
||||
// 5. 下载
|
||||
setProgress(95, '正在下载...');
|
||||
const url = URL.createObjectURL(blob);
|
||||
const title = jsonData.source?.title || 'webpage';
|
||||
const safeTitle = title.replace(/[\\/:*?"<>|]+/g, '-').replace(/\s+/g, '-').slice(0, 64) || 'webpage';
|
||||
const filename = `web-to-ppt/${safeTitle}-${Date.now()}.pptx`;
|
||||
|
||||
await chrome.downloads.download({ url, filename });
|
||||
try {
|
||||
const dlId = await chrome.downloads.download({ url, filename });
|
||||
console.log('[WebToPPT] download started, id:', dlId);
|
||||
} catch (dlErr) {
|
||||
console.error('[WebToPPT] download failed:', dlErr);
|
||||
throw dlErr;
|
||||
}
|
||||
setTimeout(() => URL.revokeObjectURL(url), 60000);
|
||||
|
||||
setProgress(100, `已导出:${filename}`);
|
||||
|
||||
Reference in New Issue
Block a user