From 5127df5e96f52dfc500ec28a8d520ffd84a9fbea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=BF=9B?= Date: Mon, 27 Jul 2026 15:45:51 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20SVG=20=E5=A4=84=E7=90=86=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-to-ppt/capture.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web-to-ppt/capture.js b/web-to-ppt/capture.js index f894ebc..996ddbb 100644 --- a/web-to-ppt/capture.js +++ b/web-to-ppt/capture.js @@ -988,12 +988,14 @@ if ((element.tagName === "SVG" || element.tagName === "svg") && !backgroundUrls.length) { try { const svgClone = element.cloneNode(true); - // 确保有 xmlns if (!svgClone.getAttribute('xmlns')) svgClone.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); const svgStr = new XMLSerializer().serializeToString(svgClone); const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(svgStr))); backgroundUrls = [svgDataUrl]; - } catch (e) { /* 静默失败 */ } + console.log('[WebToPPT] SVG captured:', (element.className || element.id || '').slice(0, 30), 'size:', svgStr.length); + } catch (e) { + console.warn('[WebToPPT] SVG capture failed:', e.message, element.tagName, (element.className || '').slice(0, 30)); + } } const type = element.tagName === "IMG" || backgroundUrls.length ? "RECTANGLE" : "FRAME";