debug: SVG 处理日志
This commit is contained in:
@@ -1008,13 +1008,15 @@
|
|||||||
|
|
||||||
// SVG → 序列化为 data URL 图片
|
// SVG → 序列化为 data URL 图片
|
||||||
if ((element.tagName === "SVG" || element.tagName === "svg") && !node.backgroundImages.length) {
|
if ((element.tagName === "SVG" || element.tagName === "svg") && !node.backgroundImages.length) {
|
||||||
|
console.log('[WebToPPT] SVG found:', element.tagName, (element.className||'').slice(0,30));
|
||||||
try {
|
try {
|
||||||
const svgClone = element.cloneNode(true);
|
const svgClone = element.cloneNode(true);
|
||||||
if (!svgClone.getAttribute("xmlns")) svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
if (!svgClone.getAttribute("xmlns")) svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
||||||
const svgStr = new XMLSerializer().serializeToString(svgClone);
|
const svgStr = new XMLSerializer().serializeToString(svgClone);
|
||||||
node.backgroundImages = ["data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svgStr)))];
|
node.backgroundImages = ["data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svgStr)))];
|
||||||
node.type = "RECTANGLE";
|
node.type = "RECTANGLE";
|
||||||
} catch (e) { /* 静默失败 */ }
|
console.log('[WebToPPT] SVG captured:', node.backgroundImages[0].length, 'bytes');
|
||||||
|
} catch (e) { console.warn('[WebToPPT] SVG failed:', e.message); }
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
Reference in New Issue
Block a user