mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 18:03:50 +00:00
Add standalone mode for HTML artifact downloads
When downloading HTML artifacts, the generated HTML now works standalone without requiring the extension runtime. Changes: - Add PrepareHtmlOptions config object to SandboxedIframe.prepareHtmlDocument() - Add isStandalone flag to skip runtime bridge and navigation interceptor - When isStandalone=true: - window.sendRuntimeMessage is NOT defined - Navigation interceptor is NOT injected - Artifact runtime providers fall back to embedded data - HtmlArtifact download button now uses isStandalone: true This fixes the issue where downloaded HTML artifacts would: - Try to call window.sendRuntimeMessage (which would fail silently) - Try to postMessage to non-existent parent window - Not work when opened via file:// protocol Now downloaded artifacts work completely standalone with embedded data.
This commit is contained in:
parent
63bfe95c18
commit
26b774bb04
3 changed files with 66 additions and 24 deletions
|
|
@ -48,7 +48,10 @@ export class HtmlArtifact extends ArtifactElement {
|
|||
const sandbox = this.sandboxIframeRef.value;
|
||||
const sandboxId = `artifact-${this.filename}`;
|
||||
const downloadContent =
|
||||
sandbox?.prepareHtmlDocument(sandboxId, this._content, this.runtimeProviders || [], true) || this._content;
|
||||
sandbox?.prepareHtmlDocument(sandboxId, this._content, this.runtimeProviders || [], {
|
||||
isHtmlArtifact: true,
|
||||
isStandalone: true, // Skip runtime bridge and navigation interceptor for standalone downloads
|
||||
}) || this._content;
|
||||
|
||||
return html`
|
||||
<div class="flex items-center gap-2">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue