ZDDC/browse/js
ZDDC bbbf5326e7 refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence
Nine copies of escapeHtml (some escaping single-quotes + handling null,
others not), two byte-identical hashContent hashers, two saveContent
writers, two isZipMemberNode predicates, the ISO-date + YAML-quote helpers
duplicated across the workflow modals, three /.profile/access email
fetchers, and three byte-size formatters had all drifted across the browse
modules. Hoist a single browse-local window.app.modules.util (no new global;
concatenated right after init.js) and alias the call sites to it.

Reliability fix folded in: the YAML editor's saveContent skipped the
upload.ensureWritable() escalation that the markdown editor performs, so
saving a .yaml/.zddc file to a read-only-picked local folder failed where
markdown succeeded. Both now go through util.saveFile, which always
escalates — the shared writer makes the two editors impossible to drift
apart again.

Canonical escapeHtml is the strict superset (escapes & < > " ', null →
"") so it's a safe drop-in for every prior variant. fmtSize gains the GB
tier everywhere (history.js previously capped at MB). Also removes the dead
stage.js fetchSelfEmail (defined, never called).

Net −200 lines across the modules. No behavior change beyond the save fix;
all 6 browse Playwright specs pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 15:07:00 -05:00
..
accept-transmittal.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
app.js fix(browse): editor lifecycle — dispose on switch, guard unsaved edits, kill leaks 2026-06-03 14:46:31 -05:00
create-transmittal.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
download.js refactor: virtual file extensions for subtree zip + MD conversion 2026-05-14 12:23:37 -05:00
events.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
grid.js feat(zddc): Phase 4b — grid mode driven by cascade default_tool 2026-05-11 16:15:25 -05:00
history.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
hovercard.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
init.js feat(browse): SPA overhaul — context menu, YAML editor, icons, hovercard, deep links, autofilter 2026-05-14 12:12:42 -05:00
loader.js feat(browse): markdown version-history viewer with diff + restore 2026-05-28 12:49:00 -05:00
plan-review.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
preview-markdown.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
preview-yaml.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
preview.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
stage.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
tree.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
upload.js feat(browse): full create/edit/rename/delete in local-directory (offline) mode 2026-06-01 10:46:51 -05:00
util.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00