Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

refactor(svg): finish viewBox-single-truth follow-through in preview and docs

hugohe30c14c2e6e066
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 40fc20ac..25ac5dff 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -169,7 +169,7 @@ One offending character invalidates the file and aborts export. Numeric refs (`&
## 4. Basic SVG Rules
-- **viewBox** MUST match the canvas dimensions; it is the single source of truth for canvas size. Root `width`/`height` are optional — if written, they MUST equal `viewBox`
+- **viewBox** MUST match the canvas dimensions; it is the single source of truth for canvas size. Root `width`/`height` are optional compatibility attributes and are not used as PPT Master canvas authority.
- **Background**: Use `<rect>` to define the page background color
- **`<tspan>`** has two purposes: (1) manual line breaks (use `dy` or explicit `y`); (2) inline run formatting on the same line (color/weight/size). `<foreignObject>` is FORBIDDEN. See "Single logical line" rule below.
- **Fonts**: every `font-family` stack MUST end with a pre-installed family (Microsoft YaHei / SimSun / Arial / Times New Roman / Consolas …); `@font-face` is FORBIDDEN. Full rule: [`strategist.md §g`](strategist.md).
diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.md
index 7b36b18a..fb167e18 100644
--- a/skills/ppt-master/scripts/docs/svg-pipeline.md
+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md
@@ -127,7 +127,6 @@ python3 scripts/svg_quality_checker.py examples/project --export
Checks include:
- `viewBox`
- banned elements
-- width/height consistency
- line-break structure
## `svg_position_calculator.py`
diff --git a/skills/ppt-master/scripts/svg_editor/static/app.js b/skills/ppt-master/scripts/svg_editor/static/app.js
index 745221d7..47243548 100644
--- a/skills/ppt-master/scripts/svg_editor/static/app.js
+++ b/skills/ppt-master/scripts/svg_editor/static/app.js
@@ -618,14 +618,15 @@
// Empty-canvas guard: surface a clear error if the SVG parsed
// to nothing renderable (issue #115's silent-blank scenario).
var rootSvg = svgContent.querySelector("svg");
- // The width/height:auto preview CSS collapses without the root
- // attributes (issue #115); derive them from viewBox at render
- // time. View-layer only — the file on disk is never touched.
- if (rootSvg && (!rootSvg.hasAttribute("width") || !rootSvg.hasAttribute("height"))) {
+ // viewBox is the PPT Master canvas authority. Normalize the
+ // preview DOM from it so stale or missing root width/height
+ // cannot shrink the slide. View-layer only — the file on disk
+ // is never touched.
+ if (rootSvg) {
var vb = (rootSvg.getAttribute("viewBox") || "").trim().split(/[\s,]+/);
if (vb.length === 4 && parseFloat(vb[2]) > 0 && parseFloat(vb[3]) > 0) {
- if (!rootSvg.hasAttribute("width")) rootSvg.setAttribute("width", vb[2]);
- if (!rootSvg.hasAttribute("height")) rootSvg.setAttribute("height", vb[3]);
+ rootSvg.setAttribute("width", vb[2]);
+ rootSvg.setAttribute("height", vb[3]);
}
}
var hasContent = false;