docs: note srcdoc relative-asset limitation in html viewer

This commit is contained in:
Gagancreates 2026-05-08 16:46:22 +05:30
parent 385ed3377f
commit 89f56a8059

View file

@ -124,6 +124,14 @@ export function HtmlFileViewer({ path }: HtmlFileViewerProps) {
) )
} }
// We use `srcDoc` here (not `src=app://workspace/<path>`) so the iframe
// gets a null origin with no base URL. Trade-off: relative assets inside
// the file — `<link href="./style.css">`, `<img src="./pic.png">`,
// `<script src="./foo.js">` — will silently 404. Self-contained HTML
// works fine; HTML that ships next to sibling assets will look broken.
// TODO: switch to `src=app://workspace/<path>` if we want relative-asset
// support; that path also resolves through the existing path-traversal
// guard in resolveWorkspacePath.
return ( return (
<div className="relative h-full w-full"> <div className="relative h-full w-full">
{state.kind === 'loaded' && ( {state.kind === 'loaded' && (