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. |
||
|---|---|---|
| .. | ||
| fonts | ||
| vendor | ||
| base.css | ||
| build-lib.sh | ||
| build-words.txt | ||
| favicon.svg | ||
| fonts.css | ||
| hash.js | ||
| help.js | ||
| logo.css | ||
| logo.js | ||
| nav.css | ||
| nav.js | ||
| preview-lib.js | ||
| theme.js | ||
| toast.css | ||
| toast.js | ||
| zddc-filter-test.html | ||
| zddc-filter.js | ||
| zddc-source.js | ||
| zddc-test.html | ||
| zddc.js | ||
| zip-source.js | ||