ZDDC/browse/js
ZDDC b34edcecac feat(browse): markdown editor — editable YAML front matter + DOCX/HTML/PDF download buttons
Two improvements to browse's preview-markdown plugin so it can replace
the standalone mdedit tool:

1. **YAML front-matter editing.** The FM pane above the outline used to
   render a read-only <dl> of parsed keys — sparse and unusable when
   the file had no envelope yet. It's now a dedicated <textarea> that's
   always present. On load, parseFrontMatter() splits the `---\n…\n---`
   envelope off the body: the body feeds Toast UI Editor, the envelope
   feeds the textarea. On save, assembleContent() recombines them.
   Dirty tracking covers both halves via a SHA-256 of the assembled
   bytes. The shell mirrors mdedit's old layout (FM textarea top,
   outline below) but the FM pane is now always functional, eliminating
   the "empty pane over the TOC" problem.

2. **Download as DOCX / HTML / PDF.** When the file handle is HTTP-
   backed (server mode) and the file is a .md, three buttons appear in
   the info header next to Save. Clicking one fetches the server's
   ?convert=<fmt> endpoint and triggers a browser download with a
   clean filename (foo.md → foo.docx). Auto-saves the buffer first if
   dirty so the converted bytes reflect what's on screen.

Helper at window.zddc.source.downloadConverted (shared/zddc-source.js)
so other tools — archive, transmittal — can reuse the same flow later.
Friendly error messages map HTTP 503 / 422 / 504 to actionable toasts.
2026-05-13 10:32:38 -05:00
..
app.js feat(zddc): Phase 4b — grid mode driven by cascade default_tool 2026-05-11 16:15:25 -05:00
download.js feat(browse): "Download (zip)" — pull the current directory's subtree as a zip 2026-05-12 13:04:04 -05:00
events.js feat(browse): "Download (zip)" — pull the current directory's subtree as a zip 2026-05-12 13:04:04 -05:00
grid.js feat(zddc): Phase 4b — grid mode driven by cascade default_tool 2026-05-11 16:15:25 -05:00
init.js feat(archive,browse): treat .zip transmittal folders as folders + shared zip adapter 2026-05-12 12:29:14 -05:00
loader.js feat(zddc): Phase 4b — grid mode driven by cascade default_tool 2026-05-11 16:15:25 -05:00
preview-markdown.js feat(browse): markdown editor — editable YAML front matter + DOCX/HTML/PDF download buttons 2026-05-13 10:32:38 -05:00
preview.js feat(archive,browse): treat .zip transmittal folders as folders + shared zip adapter 2026-05-12 12:29:14 -05:00
tree.js feat(archive,browse): treat .zip transmittal folders as folders + shared zip adapter 2026-05-12 12:29:14 -05:00
upload.js feat(zddc): Phase 4a — drop_target cascade key, browse upload zone migrated 2026-05-11 16:12:41 -05:00