feat(pptx): support PowerPoint templates (.potx)#77
Merged
Conversation
.potx and .pptx share an identical OOXML package; only the main part's content type in [Content_Types].xml differs. Extend the importer/exporter to preserve template-ness across the round-trip. - Add isPptxTemplate(blob): detect a template by package content type rather than filename extension - serializeDeck gains asTemplate?: boolean; when omitted, inherit from the source archive so a parsed .potx round-trips back to a .potx. Templates emit the template.main+xml main-part content type and .potx MIME - Website: accept .potx, detect template-ness from content, export .potx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends the PPTX importer/exporter to support PowerPoint templates (
.potx)..potxand.pptxshare an identical OOXML package — the only on-disk difference is the main part's content type in[Content_Types].xml(…presentationml.template.main+xmlvs…presentation.main+xml). This PR preserves template-ness across the full import → edit → export round-trip.Changes
Library (
@textcortex/slidewise)isPptxTemplate(blob)— detects a template by inspecting the package content type rather than trusting a filename extension, so a mis-named.pptxthat is really a template is handled correctly.serializeDeckgainsasTemplate?: boolean— when omitted, template-ness is inherited from the source archive, so a parsed.potxround-trips back to a.potx; passtrue/falseto force the output kind. Templates emit thetemplate.main+xmlmain-part content type and the.potxMIME type.parsePptxitself needed no changes — it reads parts by path, not by content type, so it already parsed.potxtransparently.Website
.pptx/.potxin the upload gate,acceptfilter, drag prompt, and button label.isPptxTemplate, and exports.potx(withasTemplate) when the loaded file was a template.Behavior
.potx.potx(inherited by content type, no flag).pptx.pptxLibrary callers can override with
serializeDeck(deck, { asTemplate: true | false }).Tests
New
template.test.ts(6 cases): default → presentation CT/MIME;asTemplate→ template CT/MIME;isPptxTemplatecontent-vs-filename + garbage-input handling; parses a.potx; auto round-trips template→template; can force template→presentation.tsc --noEmitclean (library + website)pnpm build:libsucceeds;isPptxTemplateconfirmed in the bundleA changeset (
minor, new public API) is included.