fix: 去掉 background.js 的 JSON 调试下载
该下载在 PPTX 转化前触发,转化失败时用户只看到 JSON。
This commit is contained in:
@@ -146,17 +146,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
assertCaptureableTab(tab);
|
||||
const data = await captureCurrentTab(tab, settings);
|
||||
lastCaptureData = data;
|
||||
// 保存 JSON 供调试
|
||||
try {
|
||||
const json = JSON.stringify(data, null, 2);
|
||||
const encoded = btoa(unescape(encodeURIComponent(json)));
|
||||
const title = data.source?.title || 'debug';
|
||||
const safe = title.replace(/[\\/:*?"<>|]+/g, '-').slice(0, 32);
|
||||
chrome.downloads.download({
|
||||
url: 'data:application/json;base64,' + encoded,
|
||||
filename: 'web-to-ppt/' + safe + '-' + Date.now() + '.json'
|
||||
});
|
||||
} catch(e) {}
|
||||
|
||||
return { ok: true, actualViewportWidth: data.source?.actualViewportWidth };
|
||||
})()
|
||||
.then(sendResponse)
|
||||
|
||||
Reference in New Issue
Block a user