fix(desktop): Export as HTML uses the current doc + lets you choose the location#179
Merged
Merged
Conversation
…e where
Two bugs in "Export as HTML":
1. It always exported a fixed "Welcome to Markup" document. The menu listener is
registered once (empty-deps effect), so handleExportHtml closed over the
first render's `tab` — the initial welcome buffer — not the active one. It now
reads the live active tab from the store (useAppStore.getState()), matching
how Save / Save As already work. Same stale-closure fix applied to Export PDF.
2. It silently downloaded to ~/Downloads. It now opens a Save dialog so the user
picks the destination (filtered to .html, path authorized via the existing
save-panel grant), writes the rendered HTML there, and shows an "Exported …"
toast. Cancelling the dialog is a no-op.
- tauri.ts: pickHtmlSavePath (save dialog + authorize).
- App.tsx: handleExportHtml/handleExportPdf read the live tab; export writes to
the chosen path via the existing write_file.
- Removed the now-dead browser-download exportHtml/downloadString helpers.
- EN + 中文 "Exported {0}" toast.
tsc ✓ · biome ✓ · build ✓.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merged
oratis
added a commit
that referenced
this pull request
Jun 18, 2026
Patch release on top of v1.0.0 with the unreleased desktop fixes: - Export as HTML exports the current document + lets you choose the save location (#179). - About dialog: Check for Updates + Changelog (#180). Bumps package.json / tauri.conf.json / Cargo.toml (+ Cargo.lock) to 1.0.1 and adds docs/release-notes-v1.0.1.md. iOS is unaffected (desktop-only changes). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes the reported bug: Export as HTML exported a fixed "Welcome to Markup" document instead of the open one, and dumped it into ~/Downloads with no location choice.
Root cause
handleExportHtmlclosed over the render-scopetab, but the menu listener is registered once in an empty-deps effect — so it captured the first render's tab (the welcome buffer). Every export rendered that, regardless of what you had open. (Export PDF had the same latent bug.)Fix
useAppStore.getState()), exactly like Save / Save As..html, path authorized via the existing save-panel grant), writes the rendered HTML to the chosen path via the existingwrite_file, and shows an "Exported …" toast. Cancelling is a no-op. (No more silent Downloads dump.)exportHtml/downloadStringhelpers; addedpickHtmlSavePath; EN + 中文 toast string.Verify
tsc✓ ·biome✓ ·pnpm build✓. (Sandbox/MAS-safe: writing to a user-picked path is authorized by the save panel, same as Save As.)🤖 Generated with Claude Code