mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-11 00:02:38 +02:00
docs: note srcdoc relative-asset limitation in html viewer
This commit is contained in:
parent
385ed3377f
commit
89f56a8059
1 changed files with 8 additions and 0 deletions
|
|
@ -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' && (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue