From 197642b4102a45c117a3cd47836d4e3511111d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=9B?= Date: Mon, 27 Jul 2026 15:28:47 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E9=87=87=E9=9B=86=E5=90=8E=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=20JSON=20=E4=BE=9B=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-to-ppt/background.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web-to-ppt/background.js b/web-to-ppt/background.js index d5f36db..d90faa3 100644 --- a/web-to-ppt/background.js +++ b/web-to-ppt/background.js @@ -146,6 +146,17 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { assertCaptureableTab(tab); const data = await captureCurrentTab(tab, settings); lastCaptureData = data; + // 调试:保存 JSON 到 Downloads + 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); + await 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)