ZDDC/archive/js
ZDDC 3494053421 fix(preview): render HTML files instead of showing literal source
HTML files in the file previewer (archive, transmittal, classifier
popups) were dispatched to the text renderer because 'html'/'htm'
are in shared/preview-lib.js's TEXT_EXTENSIONS (which is shared with
the syntax-highlighting code path). Result: opening an .html file in
preview showed its source as a <pre> block, not the rendered page.

Fix in each tool's popup builder + dispatcher:

  - Add 'html' / 'htm' to the iframe branch (alongside pdf), so the
    popup ships an <iframe src=blob:...> instead of an empty
    #previewContent div. The blob's MIME type from getMimeType()
    is already 'text/html', so the browser renders natively.
  - Skip the text-render dispatch for html/htm (the iframe is enough).
  - Add  to the HTML iframe so an arbitrary archived
    HTML file cannot run scripts, navigate top, submit forms, or
    open popups in the popup-window's origin. PDFs don't need this
    since the browser's PDF viewer is sandboxed natively.

classifier/js/preview.js uses a getPreviewType() switch instead of
chained ifs; adds 'html' as its own preview type (checked BEFORE
'text' since html is in TEXT_EXTENSIONS).

mdedit already handled HTML specially (file-tree.js has an isHtml
check); no change there.

TIFF was already rendered via the shared zddc.preview.renderTiff
canvas viewer in all four tools — no change needed for that path.
If TIFF preview appears broken on the live prod server, that's the
v0.0.9-alpha-baked-in image; the fresh stable redeploy fixes it.
2026-05-03 16:48:19 -05:00
..
app.js feat: lockstep release infra + cascade/.archive fixes + profile perf + page redesign 2026-05-01 20:11:38 -05:00
directory.js feat(tools,build): in-flight HTML-tool reworks and build-infra updates 2026-04-29 12:52:27 -05:00
drag-drop.js Initial commit 2026-04-27 11:05:47 -05:00
events.js Initial commit 2026-04-27 11:05:47 -05:00
export.js Initial commit 2026-04-27 11:05:47 -05:00
filtering.js feat(tools,build): in-flight HTML-tool reworks and build-infra updates 2026-04-29 12:52:27 -05:00
hash.js Initial commit 2026-04-27 11:05:47 -05:00
init.js feat(tools,build): in-flight HTML-tool reworks and build-infra updates 2026-04-29 12:52:27 -05:00
parser.js Initial commit 2026-04-27 11:05:47 -05:00
presets.js feat(tools,build): in-flight HTML-tool reworks and build-infra updates 2026-04-29 12:52:27 -05:00
source.js feat(tools,build): in-flight HTML-tool reworks and build-infra updates 2026-04-29 12:52:27 -05:00
table.js fix(preview): render HTML files instead of showing literal source 2026-05-03 16:48:19 -05:00
url-state.js feat(tools,build): in-flight HTML-tool reworks and build-infra updates 2026-04-29 12:52:27 -05:00