From 26401e831564edd0af69ea25a48ce6eaa60aba5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=9B?= Date: Mon, 27 Jul 2026 18:28:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89=20background.js=20?= =?UTF-8?q?=E7=9A=84=20JSON=20=E8=B0=83=E8=AF=95=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 该下载在 PPTX 转化前触发,转化失败时用户只看到 JSON。 --- web-to-ppt/background.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/web-to-ppt/background.js b/web-to-ppt/background.js index afc96d3..5cf57dd 100644 --- a/web-to-ppt/background.js +++ b/web-to-ppt/background.js @@ -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)