From 3c346e43e5007114b556589fccb905f083d1281a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=9B?= Date: Mon, 27 Jul 2026 16:22:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=81=A2=E5=A4=8D=20JSON=20=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=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..afc96d3 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 供调试 + 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)