Conversation
Signed-off-by: HUANG <15866338256@163.com>
There was a problem hiding this comment.
Findings
-
[Minor] MIME allowlist mismatch between the DOM extractor and the model writer can hard-fail native PPTX export —
packages/exporters/src/pptx-dom.tspromotes an<img>to an independent image whencurrentSrc/srcmatches/^data:image\/(png|jpe?g);base64,/i(soimage/jpgis accepted, and matching is case-insensitive), butpackages/exporters/src/pptx-model.tscheckElementvalidates image data with/^data:image\/(png|jpeg|gif);base64,[A-Za-z0-9+/]+={0,2}$/(nojpg, case-sensitive, and it advertisesgifwhich the extractor never produces). A design containing<img src="data:image/jpg;base64,..." />(or an uppercaseimage/PNGdata URL) passes extraction as a native image and is then rejected bycheckElement, so the whole native export throws instead of degrading to a warned raster fallback. If the workspace asset pipeline inlines.jpgfiles asimage/jpg, this would hit every jpg image in a deck.
Suggested fix: align the writer with the extractor, e.g.^data:image\/(png|jpe?g|gif);base64,[A-Za-z0-9+/]+={0,2}$with theiflag, and add apackages/exporters/src/pptx-model.test.tscase for ajpgdata URL. -
[Nit] The new mode is not recorded in the local action log —
apps/desktop/src/renderer/src/store/slices/generation.tsstill callsrecordAction({ type: 'design.export', data: { format } }), so history cannot distinguish an image-first PPTX export from the native beta. Suggest addingrenderModetodatawhen present.
Questions
apps/desktop/src/main/preview-runtime.tsremoves three// @ts-expect-error browser contextdirectives, yet this PR changes no tsconfig. Is this forced by the new/// <reference lib="dom" />inpackages/exporters/src/pptx-dom.ts, which adds the DOM lib program-wide for consumers that type-check exporters from source? If so, the Electron main-process program now has DOM globals typed, which removes a useful guard against accidentally using DOM APIs inapps/desktop/src/main/**. If intentional, a one-line note in the PR body would help reviewers.
Summary
- Review mode: initial
- No Blockers or Majors found. The feature is genuinely opt-in (separate
PPTX (editable, beta)menu action), the image-first default and legacyeditablemode are preserved and covered by tests,parseRequestvalidatesrenderModebefore any save dialog or exporter call, and conversion fallbacks surface as user-visibleexportWarningsrather than silent drops (packages/exporters/src/pptx-model.tsaddNativeSlidesvalidates the whole deck before mutating the presentation, and unresolved rasters throw descriptively). - Linked issue: the PR uses
Refs #284and explicitly does not claim to close it, so no completion-claim validation applies. - Constraints: only a test-only devDependency (
@xmldom/xmldom@0.8.13, MIT) is added; no direct provider SDK imports; heavy exporter deps stay dynamically imported; thepptxgenjs@4.0.1repair is version-scoped, tracked inpatches/and pinned by lockfile patch hash with maintenance instructions inpatches/README.md; noconsole.*inpackages/exporters/**. - Residual risk: fidelity and Office compatibility are explicitly Beta. The browser suites use
skipIf(!chromePath), so a skipped run is not a compatibility pass (the README says so). Also notepackages/exporters/src/pptx-native.browser.test.tsreadsapps/desktop/resources/templates/design-skills/slide-deck.jsxacross packages, so moving that resource will break the exporters suite.
Testing
- Not run (automation). Suggested additions: a
packages/exporters/src/pptx-model.test.tscase asserting adata:image/jpg;base64,...image is accepted after aligning the regex, plus a browser case covering a jpg data-URL image in an otherwise native slide.
Open-CoDesign Bot
Summary
Add an opt-in, layout-aware editable PPTX Beta alongside the existing image-first PPTX export. Chromium executes HTML/JSX and measures the rendered document; a small slide model writes native text lines, basic shapes and independent images. Unsupported regions degrade locally with warnings instead of silently losing content or flattening an otherwise editable slide.
This is one phase-one export feature, including desktop wiring, package compatibility fixes, regression coverage and its authoring/acceptance contract. It does not replace the image-first default, change the legacy heading/bullet library mode, or promise arbitrary CSS fidelity.
Included
PPTX (editable, beta)menu action; validated IPC/store forwarding and export warnings independent of research-source warnings.Type of change
Linked issue
Refs #284 as follow-up context for editable PPTX fidelity. That issue is already closed; this PR does not reopen it or claim to resolve its other export-format concerns.
Validation
Local environment: Windows, Node 24.11.1, pinned pnpm 10.33.4, installed system Chromium. Upstream CI uses Node 22/Linux and remains a separate check.
Beta boundaries
Dependency and design checks
No new production dependencies, bundled browser/model/font runtimes, or startup loading. The only new direct dev dependency is MIT-licensed
@xmldom/xmldom@0.8.13, used to validate generated package XML in tests. The existing PptxGenJS dependency is repaired through a tracked pnpm patch; maintenance/removal instructions are included.Checklist
Screenshot
Actual toolbar and menu rendered with synthetic preview state; no user design content, private paths or live desktop capture.