Skip to content

Issue #105: Save As proposes a PowerPoint .pptx file - #155

Open
LloydNicholson wants to merge 2 commits into
storytold:mainfrom
LloydNicholson:fix/save-pptx-default
Open

LloydNicholson wants to merge 2 commits into
storytold:mainfrom
LloydNicholson:fix/save-pptx-default

Conversation

@LloydNicholson

Copy link
Copy Markdown
Contributor

Fixes #105.

Problem

Save As (and the first Save of a new presentation) always suggested <title>.deckcraft: SlideApp::save_as_dialog was called with "deckcraft" from every path (menu, ⌘⇧S, ⌘S on an unsaved deck, file.saveAs without a path). The desktop save dialog had no file types, so there was no way to pick PowerPoint other than typing the extension. The web build downloaded a .deckcraft file.

Fix

  • Suggested name: .pptx, except for a presentation opened from a .deckcraft file, which keeps its format. A .potx, .ppsx or outline (.txt/.md) file is proposed as .pptx, because the PowerPoint writer always writes a presentation (presentation.main content type), so it doesn't offer formats it can't really write.
  • Desktop dialog filters: new deckcraft_ui_egui::save_filters(name). For a presentation it returns PowerPoint Presentation (.pptx) and DeckCraft Presentation (.deckcraft), with the proposed format first. The desktop pick_save adds them to the rfd dialog. Names for exports (PDF, PNG, …) get no filters, so the Export dialog is unchanged.
  • Web: Save As downloads a .pptx.

The engine commands (file.save / file.saveAs with a path) are unchanged. They still choose the format from the path's extension.

Testing

  • New tests in crates/ui-egui/src/lib.rs, all failing on upstream/main:
    • save_as_proposes_a_pptx_file: app.saveAsDialog, Save on an unsaved deck and file.saveAs without a path all propose <title>.pptx. A deck opened from .deckcraft keeps .deckcraft, and .PPTX/.potx/.txt are proposed as .pptx.
    • save_as_downloads_a_pptx_file: without a save dialog (web) the download is named .pptx and is a PowerPoint package.
    • save_filters_offer_the_formats_deckcraft_writes.
  • cargo xtask ci: all 6 steps passed (fmt, clippy, test, assets, layers, wasm).
  • The native save panel itself couldn't be inspected from the test machine (no accessibility or screen-recording access). The filter list is passed straight to rfd.

🤖 Generated with Claude Code

Save As, and the first Save of a new presentation, suggested
`<title>.deckcraft` and the desktop save dialog had no file types, so
saving a PowerPoint file meant typing the extension by hand.

The suggestion is now `.pptx`, except for a presentation that was opened
from a `.deckcraft` file, which keeps its format. A `.potx`, `.ppsx` or
outline file is proposed as `.pptx`, since the PowerPoint writer always
writes a presentation. The desktop dialog lists the two formats Save As
writes, PowerPoint Presentation (.pptx) and DeckCraft Presentation
(.deckcraft), with the proposed one first. The web build downloads a
`.pptx` file. Export dialogs are unchanged.

Fixes storytold#105

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
)

A page's /Contents array is one content stream in pieces that writers may
split between any two tokens (ISO 32000-2 §7.8.2). Edit text parsed each
piece on its own, so an operator whose operands ended one piece and whose
keyword started the next arrived with no operands: a `[(After) -20 (wards)]`
/ `TJ` split made the line vanish from text_lines, text_paragraphs and
text_edit, and from the Edit text tool.

The joined-parse logic the redaction interpreter used (storytold#153) moves into
pdfcraft-content as `Pieces`: join the pieces, parse them as one stream,
map positions back to pieces, and splice joined byte ranges back into
per-piece bytes (an edit replacing or removing an operator that spans
pieces rewrites every piece it touches; untouched pieces keep their
objects). text_lines now interprets the joined operators, and replace_line
and rewrite_block splice through `Pieces`. Redaction uses the same helper.

Lines and paragraphs are grouped by the piece their first operator starts
in, as before, so pages whose pieces are separate drawings don't merge.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: Save As proposes a PowerPoint .pptx file (issue #105). The save dialog is built with filters from save_filters(name) (a label and extensions for each), and app.saveAsDialog no longer passes the application name. PowerPoint proposes .pptx, so the oracle fits, but whether the native format of the suite should be proposed first is the format decision for the maintainers (see deckcraft#388, PPTX as default format). The dialog change is small and the filter list function is testable. The first filter should be the one that matches the extension of the current file, so that a document opened as .odp is not renamed on save by mistake. A test of save_filters for each extension is the proof. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

Changes needed:

This makes Save As, the first Save of a new presentation and file.saveAs without a path suggest a .pptx file, keeps .deckcraft for decks opened from .deckcraft, and adds PPTX and DeckCraft filters to the desktop save dialog.

  • The choice of suggested extension in save_as_ext (crates/ui-egui/src/lib.rs:962-967) is correct: .potx, .ppsx and outline files are written through the PPTX exporter (crates/engine/src/cmd/file.rs:114), so suggesting .pptx for them is accurate.
  • The main branch has since moved this code to crates/ui-egui/src/app/files.rs and added a Save As type picker in the File menu's Info pane that calls save_as_dialog(fmt) with an explicit "pptx" or "deckcraft" (crates/ui-egui/src/backstage/info.rs:174-176). Removing the format parameter breaks that caller. One option is a parameter such as Option<&str>: an explicit choice wins, and None falls back to save_as_ext.
  • The Export dialog's PPTX export suggests .pptx (crates/ui-egui/src/dialogs.rs:438-442), so save_filters now gives that export PPTX and DeckCraft filters. A DeckCraft filter has no place in an export, so the Export dialog does change, unlike the description says.
  • On the main branch the same hard-coded "deckcraft" sits at crates/ui-egui/src/app/commands.rs:244 and crates/ui-egui/src/app/files.rs:496 and :514. All three need the change after the rebase.
  • Saving to .pptx keeps less than .deckcraft (for example, comment threads are flattened). With .pptx as the default for new decks, that loss reaches more users.

Claims checked:

  • verified: Save As from the menu, Save on an unsaved deck, and file.saveAs without a path all suggest .pptx, except for a deck opened from a .deckcraft file, which keeps .deckcraft. (crates/ui-egui/src/lib.rs:371, 477 and 495 call save_as_dialog(), and lib.rs:433 picks the extension with save_as_ext. lib.rs:9…
  • verified: A .potx, .ppsx or outline file is suggested as .pptx because the PPTX writer always writes a presentation. (crates/ui-egui/src/lib.rs:966 returns "pptx" for any non-.deckcraft path. crates/engine/src/cmd/file.rs:114 sends pptx, potx and ppsx through the same deckcraft_pptx::export, and file.rs:145-…
  • verified: The desktop save dialog offers a .pptx filter and a .deckcraft filter, with the suggested format first. (crates/ui-egui/src/lib.rs:952-959 returns [PPTX, DECKCRAFT] for .pptx names and [DECKCRAFT, PPTX] for .deckcraft names. apps/deckcraft/src/main.rs:111-114 folds them into rfd::FileDialog::add_fi…
  • contradicted: Names for exports get no filters, so the Export dialog is unchanged. (crates/ui-egui/src/dialogs.rs:438 and 442 build .pptx for the PPTX export and pass it to the same pick_save, so crates/ui-egui/src/lib.rs:956 gives it the .pptx and .deckcraft filters. Only PDF, PNG, JPEG and TXT exports get no f…
  • verified: On the web, Save As downloads a .pptx file. (crates/ui-egui/src/lib.rs:446-451: with no pick_save, the bytes come from save_bytes(&d.doc, ext) with ext "pptx" for a new deck, and are downloaded under the suggested .pptx name.)
  • verified: The engine commands file.save and file.saveAs with a path are unchanged and still choose the format from the path's extension. (The diff touches only apps/deckcraft/src/main.rs and crates/ui-egui/src/lib.rs. crates/engine/src/cmd/file.rs:143-156 still maps the path extension to the format.)

Recommendation: update the pull request; it will be reviewed again.

Reviewed at 1d5c8ec.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Saving presentation gets *.deckcraft extension by default

4 participants