ZDDC/transmittal/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 Initial commit 2026-04-27 11:05:47 -05:00
data.js Initial commit 2026-04-27 11:05:47 -05:00
dom.js Initial commit 2026-04-27 11:05:47 -05:00
drop-zones.js Initial commit 2026-04-27 11:05:47 -05:00
email-tags.js Initial commit 2026-04-27 11:05:47 -05:00
files-archive.js Initial commit 2026-04-27 11:05:47 -05:00
files-preview.js fix(preview): render HTML files instead of showing literal source 2026-05-03 16:48:19 -05:00
files-render.js Initial commit 2026-04-27 11:05:47 -05:00
files.js Initial commit 2026-04-27 11:05:47 -05:00
filters.js Initial commit 2026-04-27 11:05:47 -05:00
focus.js Initial commit 2026-04-27 11:05:47 -05:00
hydrate.js Initial commit 2026-04-27 11:05:47 -05:00
json.js Initial commit 2026-04-27 11:05:47 -05:00
live-digest.js Initial commit 2026-04-27 11:05:47 -05:00
logos.js Initial commit 2026-04-27 11:05:47 -05:00
main.js Initial commit 2026-04-27 11:05:47 -05:00
markdown-editor.js Initial commit 2026-04-27 11:05:47 -05:00
markdown.js Initial commit 2026-04-27 11:05:47 -05:00
mode.js Initial commit 2026-04-27 11:05:47 -05:00
publish-modal.js Initial commit 2026-04-27 11:05:47 -05:00
publish.js Initial commit 2026-04-27 11:05:47 -05:00
reactive.js Initial commit 2026-04-27 11:05:47 -05:00
reset.js Initial commit 2026-04-27 11:05:47 -05:00
security.js Initial commit 2026-04-27 11:05:47 -05:00
state.js Initial commit 2026-04-27 11:05:47 -05:00
util.js Initial commit 2026-04-27 11:05:47 -05:00
validation.js Initial commit 2026-04-27 11:05:47 -05:00
verification.js Initial commit 2026-04-27 11:05:47 -05:00
visibility.js Initial commit 2026-04-27 11:05:47 -05:00