Skip to content

Open source CapCut alternative.

TypeScript

feat(chatgpt): the card's editor keeps its chrome and asks the host for fullscreen

David Le89949ad0385b
diff --git a/site/scripts/eval-chatgpt-widget.ts b/site/scripts/eval-chatgpt-widget.ts
index 37775abf..cea76c0e 100644
--- a/site/scripts/eval-chatgpt-widget.ts
+++ b/site/scripts/eval-chatgpt-widget.ts
@@ -14,7 +14,7 @@ const server = Bun.serve({ port: 0, fetch(request) {
const url = new URL(request.url);
if (url.pathname === "/widget") return new Response(widgetHtml(url.origin), { headers: { "Content-Type": "text/html" } });
if (url.pathname === "/preview.mp4") return new Response(Bun.file(video));
- if (url.pathname === "/embed") return new Response(`<!doctype html><title>editor</title><p id="editor">Editor for ${url.searchParams.get("project")} via ${url.searchParams.get("code")}</p><p id="inset"></p><script>addEventListener('message', (e) => { if (e.source === parent && e.data.type === 'donkeycut:host-inset') document.getElementById('inset').textContent = String(e.data.insetBottom); }); parent.postMessage({ type: 'donkeycut:host-inset?' }, '*');</script>`, { headers: { "Content-Type": "text/html" } });
+ if (url.pathname === "/embed") return new Response(`<!doctype html><title>editor</title><p id="editor">Editor for ${url.searchParams.get("project")} via ${url.searchParams.get("code")}</p><p id="inset"></p><p id="mode"></p><button id="full" onclick="parent.postMessage({ type: 'donkeycut:fullscreen' }, '*')">Fullscreen</button><script>addEventListener('message', (e) => { if (e.source === parent && e.data.type === 'donkeycut:host') { document.getElementById('inset').textContent = String(e.data.insetBottom); document.getElementById('mode').textContent = e.data.displayMode; } }); parent.postMessage({ type: 'donkeycut:host?' }, '*');</script>`, { headers: { "Content-Type": "text/html" } });
if (url.pathname.startsWith("/clients/chatgpt/")) return new Response(Bun.file(path.join(root, "public/clients/chatgpt", path.basename(url.pathname))));
return new Response(hostHtml, { headers: { "Content-Type": "text/html" } });
} });
@@ -79,10 +79,11 @@ try {
await app.getByRole("button", { name: "Launch film" }).click();
await app.frameLocator("iframe.editor").locator("#editor").waitFor();
assert.deepEqual(await page.evaluate(() => (window as unknown as { modes: string[] }).modes), ["fullscreen"], "the editor asks for the whole window on open");
- assert.equal(await app.locator("button").count(), 1, "inline, the editor card keeps one control: fullscreen");
+ assert.equal(await app.locator("button").count(), 0, "the editor card has no controls of its own");
await app.frameLocator("iframe.editor").locator("#inset").filter({ hasText: /^0$/ }).waitFor();
- await app.getByRole("button", { name: "Fullscreen" }).click();
- await app.locator("button.fullscreen").waitFor({ state: "detached" });
+ await app.frameLocator("iframe.editor").locator("#mode").filter({ hasText: /^inline$/ }).waitFor();
+ await app.frameLocator("iframe.editor").getByRole("button", { name: "Fullscreen" }).click();
+ await app.frameLocator("iframe.editor").locator("#mode").filter({ hasText: /^fullscreen$/ }).waitFor();
await app.frameLocator("iframe.editor").locator("#inset").filter({ hasText: /^120$/ }).waitFor();
assert.deepEqual(await page.evaluate(() => (window as unknown as { modes: string[] }).modes), ["fullscreen", "fullscreen"], "the button asks again and the granted mode hides it");
await page.screenshot({ path: "/tmp/donkey-chatgpt-widget-editor.png" });
diff --git a/site/src/clients/chatgpt/ui/PreviewApp.tsx b/site/src/clients/chatgpt/ui/PreviewApp.tsx
index 40651bba..3f9718d0 100644
--- a/site/src/clients/chatgpt/ui/PreviewApp.tsx
+++ b/site/src/clients/chatgpt/ui/PreviewApp.tsx
@@ -13,8 +13,7 @@ export function PreviewApp() {
// The editor is the card: its own chrome carries every control. Inline, one
// control asks the host for the whole window.
if (editor && project) return <main className="editing" data-mode={fullscreen ? "fullscreen" : "inline"}>
- {!fullscreen && <button className="fullscreen" onClick={() => void requestFullscreen()} aria-label="Fullscreen">⤢</button>}
- <EditorFrame url={editor.url} name={project.name} inset={hostInset} />
+ <EditorFrame url={editor.url} name={project.name} inset={hostInset} fullscreen={fullscreen} onFullscreen={requestFullscreen} />
</main>;
return <main aria-busy={busy}>
<header><span className="brand">Donkey Cut</span><span>Cloud projects</span></header>
@@ -53,16 +52,19 @@ export function PreviewApp() {
</main>;
}
-/** The editor, framed. It learns how tall the host's bottom overlay is when
- * it loads, whenever that changes, and whenever it asks. */
-function EditorFrame({ url, name, inset }: { url: string; name: string; inset: number }) {
+/** The editor, framed. It learns the host's display mode and how tall the
+ * bottom overlay is when it loads, whenever that changes, and whenever it
+ * asks; its own toolbar asks for fullscreen. */
+function EditorFrame({ url, name, inset, fullscreen, onFullscreen }: { url: string; name: string; inset: number; fullscreen: boolean; onFullscreen: () => void }) {
const frame = useRef<HTMLIFrameElement>(null);
const origin = new URL(url).origin;
- const tell = () => frame.current?.contentWindow?.postMessage({ type: "donkeycut:host-inset", insetBottom: inset }, origin);
- useEffect(tell, [inset, origin]);
+ const tell = () => frame.current?.contentWindow?.postMessage({ type: "donkeycut:host", insetBottom: inset, displayMode: fullscreen ? "fullscreen" : "inline" }, origin);
+ useEffect(tell, [inset, fullscreen, origin]);
useEffect(() => {
const onMessage = (event: MessageEvent) => {
- if (event.origin === origin && event.source === frame.current?.contentWindow && event.data?.type === "donkeycut:host-inset?") tell();
+ if (event.origin !== origin || event.source !== frame.current?.contentWindow) return;
+ if (event.data?.type === "donkeycut:host?") tell();
+ if (event.data?.type === "donkeycut:fullscreen") onFullscreen();
};
window.addEventListener("message", onMessage);
return () => window.removeEventListener("message", onMessage);
diff --git a/site/src/clients/chatgpt/ui/preview.css b/site/src/clients/chatgpt/ui/preview.css
index 82cf0137..fa988a04 100644
--- a/site/src/clients/chatgpt/ui/preview.css
+++ b/site/src/clients/chatgpt/ui/preview.css
@@ -1,4 +1,4 @@
:root{font:14px/1.5 system-ui,sans-serif;color:#20201e;background:#faf9f7;color-scheme:light;--line:#dddcd6;--muted:#66645e;--panel:#fff}
:root[data-theme=dark]{color:#eeede8;background:#20201e;color-scheme:dark;--line:#45443f;--muted:#b6b3a8;--panel:#292925}
*{box-sizing:border-box}body{margin:0}main{padding:20px;max-width:840px;margin:auto}header{display:flex;justify-content:space-between;color:var(--muted);font-size:12px}.brand{font-weight:800;font-size:16px;color:inherit}h1{font-size:22px;line-height:1.2;margin:24px 0 16px;overflow-wrap:anywhere}video{width:100%;max-height:65vh;display:block;border-radius:12px;background:#000}button{font:inherit;color:inherit;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:10px 14px;cursor:pointer}button:hover{filter:brightness(.95)}button:disabled{opacity:.5;cursor:default}button:focus-visible{outline:2px solid #5d80cc;outline-offset:3px}.primary{background:#eac36a;color:#242018;border-color:#eac36a}nav{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}.projects{display:grid;gap:8px}.projects button{display:flex;justify-content:space-between;gap:16px;text-align:left}.projects button span:first-child{overflow-wrap:anywhere;min-width:0}.muted{color:var(--muted);font-size:12px}.error{color:#ba453b}progress{width:100%;accent-color:#d8a743}p{overflow-wrap:anywhere}
-.editing{padding:0;max-width:none;position:relative}.editor{display:block;width:100%;height:560px;border:0;background:#000}[data-mode=fullscreen] .editor{height:100vh}.fullscreen{position:absolute;top:8px;right:8px;z-index:1;width:32px;height:32px;padding:0;border-radius:8px;border:1px solid var(--line);background:var(--panel);color:inherit;font-size:16px;line-height:1;cursor:pointer;opacity:.85}.fullscreen:hover{opacity:1}
+.editing{padding:0;max-width:none;position:relative}.editor{display:block;width:100%;height:560px;border:0;background:#000}[data-mode=fullscreen] .editor{height:100vh}
diff --git a/site/src/cut/components/Editor.tsx b/site/src/cut/components/Editor.tsx
index f021e334..ee3bdb2a 100644
--- a/site/src/cut/components/Editor.tsx
+++ b/site/src/cut/components/Editor.tsx
@@ -1,7 +1,9 @@
"use client";
import { chatRuntime } from "@/cut/lib/chatRuntime";
-import { useHostInset } from "@/cut/lib/hostInset";
+import { useHostBridge } from "@/cut/lib/hostBridge";
+import { useCutMode } from "@/cut/lib/backend/hooks";
+import { useHostCommands } from "@/cut/lib/hostCommands";
import { useEnvironment } from "@/cut/lib/environment";
import { useCallback, useEffect, useRef, useState } from "react";
import Link from "next/link";
@@ -64,7 +66,7 @@ import {
shortcutDecline,
shortcutReached,
} from "@/cut/lib/shortcutGate";
-import { docAudioClips, docClips, docOverlays, projectDuration, serializeDoc, storedAssets, useEditor, clipLen, type VideoTrackPlacement } from "@/cut/lib/store";
+import { docAudioClips, docClips, docOverlays, projectDuration, serializeDoc, storedAssets, timelineHMax, useEditor, clipLen, type VideoTrackPlacement } from "@/cut/lib/store";
import { fileLandingAt } from "@/cut/lib/timelineDrop";
import { landOnRow } from "@/cut/lib/laneTracks";
import { playheadAt, previewAt, skimAt } from "@/cut/lib/playhead";
@@ -167,8 +169,23 @@ export function Editor({
const aiOpen = useEditor((s) => s.aiOpen);
const timelineOpen = useEditor((s) => s.timelineOpen);
const sharedFeatures = useEditor((s) => s.sharedFeatures);
- useHostInset();
+ useHostBridge();
+ // The timeline's height is bounded by the window, and the window changes
+ // size under it: a browser resize, or the ChatGPT card leaving fullscreen.
+ // The clamp is for this window only, so the height the user chose stays
+ // saved and comes back when the window grows again.
+ useEffect(() => {
+ const clamp = () => {
+ const max = timelineHMax();
+ if (useEditor.getState().timelineH > max) useEditor.setState({ timelineH: max });
+ };
+ window.addEventListener("resize", clamp);
+ return () => window.removeEventListener("resize", clamp);
+ }, []);
const { chatgpt } = useEnvironment();
+ const cutMode = useCutMode();
+ // ChatGPT's edits run in this editor while it is the card.
+ useHostCommands(projectId, chatgpt && cutMode === "cloud");
// The inspector only earns its column when the selection has a panel to
// show; otherwise (nothing selected, a subtitle cue, a transition bar — the
// Transitions tab is its panel) it is an empty white panel, so collapse it
diff --git a/site/src/cut/components/LibraryCard.tsx b/site/src/cut/components/LibraryCard.tsx
index 2ff7d076..5519089f 100644
--- a/site/src/cut/components/LibraryCard.tsx
+++ b/site/src/cut/components/LibraryCard.tsx
@@ -1,7 +1,6 @@
"use client";
import { useState, type ReactNode } from "react";
-import { useEnvironment } from "@/cut/lib/environment";
import { Download, Ellipsis, ExternalLink, Film, Image as ImageIcon, Music, Plus, Share2, Trash2, Type } from "lucide-react";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Skeleton } from "@/components/ui/skeleton";
@@ -71,7 +70,6 @@ export function LibraryCard({
onShare?: () => void;
onDragStartExtra?: (e: React.DragEvent) => void;
}) {
- const { chatgpt } = useEnvironment();
// ⌘C over the card copies its mention token. A card inside the current
// selection carries the whole set, the same rule its drag follows. A font is
// used from the font menu, so it names nothing a prompt can point a tool
@@ -383,7 +381,7 @@ export function LibraryCard({
onClick={(e) => e.stopPropagation()}
>
{onShare && <DropdownMenuItem disabled={offline} onClick={onShare}><Share2 /> Share</DropdownMenuItem>}
- {chatgpt ? null : sharedMedia ? (
+ {sharedMedia ? (
<DropdownMenuItem render={<a href={sharedMedia.downloadHref} />}>
<Download /> Download
</DropdownMenuItem>
diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsx
index 889f681c..fe78d4f6 100644
--- a/site/src/cut/components/SidePanel.tsx
+++ b/site/src/cut/components/SidePanel.tsx
@@ -769,7 +769,6 @@ function ProjectFilesPanel({
importing: boolean;
}) {
const caps = useCutCaps();
- const { chatgpt } = useEnvironment();
// Only user-imported media lives here; anything Cut created (recordings, AI
// generations, voiceovers, freeze frames, stock adds) is tagged with an
// `origin` and stays where it was made.
@@ -1180,7 +1179,7 @@ function ProjectFilesPanel({
>
<FolderOpen />
</Button>
- ) : chatgpt ? null : (
+ ) : (
<Button
variant="ghost"
size="icon-xs"
@@ -1379,7 +1378,6 @@ function AssetCard({
onDragLanded?: () => void;
}) {
const caps = useCutCaps();
- const { chatgpt } = useEnvironment();
const [saved, setSaved] = useState(false);
// Number of timeline items that would be cascade-deleted; null = no prompt.
const [confirmUses, setConfirmUses] = useState<number | null>(null);
@@ -1540,12 +1538,12 @@ function AssetCard({
<DropdownMenuItem onClick={saveToLibrary} disabled={!!asset.upload}>
<FolderPlus /> Save to library
</DropdownMenuItem>
- {!chatgpt && <DropdownMenuItem
+ <DropdownMenuItem
onClick={() => downloadMedia(projectId, asset)}
disabled={!!asset.upload}
>
<Download /> Download
- </DropdownMenuItem>}
+ </DropdownMenuItem>
{caps.revealInFinder && (
<DropdownMenuItem
onClick={() => void revealMedia(projectId, asset.fileName).catch(() => {})}
diff --git a/site/src/cut/components/TopBar.tsx b/site/src/cut/components/TopBar.tsx
index 1a6516b8..484aae75 100644
--- a/site/src/cut/components/TopBar.tsx
+++ b/site/src/cut/components/TopBar.tsx
@@ -3,7 +3,7 @@
import { useEffect, useRef, useState } from "react";
import Link from "next/link";
import { useQueryClient } from "@tanstack/react-query";
-import { Check, ChevronDown, ChevronLeft, CloudUpload, Loader2, Mic, Monitor, MoreHorizontal, Ratio, Share2, Smartphone, Sparkles, Square, Upload, Video } from "lucide-react";
+import { Check, ChevronDown, ChevronLeft, CloudUpload, Loader2, Maximize2, Mic, Monitor, MoreHorizontal, Ratio, Share2, Smartphone, Sparkles, Square, Upload, Video } from "lucide-react";
import { ChatStatusBadge, type ChatStatus } from "./ChatStatusBadge";
import { Button } from "@/components/ui/button";
import {
@@ -39,10 +39,11 @@ import { backTarget, projectHref, useCutBase } from "@/cut/lib/nav";
import { copyProjectAcross } from "@/cut/lib/projectCopy";
import { projectDuration, useEditor } from "@/cut/lib/store";
import { useEnvironment } from "@/cut/lib/environment";
+import { requestHostFullscreen, useHostDisplayMode } from "@/cut/lib/hostBridge";
import { useLocalPref } from "@/cut/lib/uiState";
import { ASPECT_PRESETS, aspectLabel, aspectOrientation, normalizeAspect, parseRatio, type Aspect } from "@/cut/lib/types";
-import { cn } from "@/lib/utils";
import { COLOR_PRESETS, ColorPicker } from "@/cut/components/ColorField";
+import { cn } from "@/lib/utils";
import { CreditsPill } from "./CreditsPill";
import { RecordDialog, type RecordMode } from "./RecordDialog";
import { ShareDialog } from "./ShareDialog";
@@ -81,14 +82,15 @@ export function TopBar({
// titles and shapes over the background frame exports like any other.
const hasPicture = useEditor((s) => projectDuration(s) > 0);
const aspect = useEditor((s) => s.aspect);
- const projectName = useEditor((s) => s.projectName);
const background = useEditor((s) => s.background);
+ const projectName = useEditor((s) => s.projectName);
const saveState = useEditor((s) => s.saveState);
const aiOpen = useEditor((s) => s.aiOpen);
const [editing, setEditing] = useState(false);
const [draft, setDraft] = useState("");
const [recordMode, setRecordMode] = useState<RecordMode | null>(null);
const { chatgpt } = useEnvironment();
+ const hostMode = useHostDisplayMode();
// The right-hand actions step down as the bar tightens: full labels →
// icon-only Share/Cloud/Export → everything in a … menu. The credits and
// storage pills never fold. Which step fits is measured against hidden copies of the
@@ -337,7 +339,7 @@ export function TopBar({
// bar tightens. Chat keeps its label in both — it is the primary control.
const actionButtons = (compact: boolean) => (
<>
- {(cutMode === "cloud" || cutMode === "browser") && (
+ {(cutMode === "cloud" || cutMode === "browser") && !chatgpt && (
// Shares are served from the cloud, so for a browser project the
// Share button leads to the move that makes sharing possible.
<Button
@@ -400,6 +402,18 @@ export function TopBar({
<Upload data-icon={compact ? undefined : "inline-start"} />
{!compact && "Export"}
</Button>
+ {chatgpt && hostMode !== "fullscreen" && (
+ <Button
+ variant="ghost"
+ size={compact ? "icon-sm" : "sm"}
+ aria-label="Fullscreen"
+ title={compact ? "Fullscreen" : undefined}
+ onClick={requestHostFullscreen}
+ >
+ <Maximize2 data-icon={compact ? undefined : "inline-start"} />
+ {!compact && "Fullscreen"}
+ </Button>
+ )}
{!chatgpt && <Button
variant={aiOpen ? "default" : "outline"}
size="sm"
@@ -542,20 +556,6 @@ export function TopBar({
</span>
{showCustomEditor && <Check className="size-3.5 text-muted-foreground" />}
</DropdownMenuItem>
- </DropdownMenuContent>
- );
- return showCustomEditor ? (
- <div
- className={cn(
- "aspect-switch flex items-center gap-1 rounded-full border bg-card px-3 py-1.5 text-xs font-medium shadow-xs",
- customInvalid ? "border-destructive text-destructive" : "border-border"
- )}
- title={customInvalid ? "Up to an 8:1 shape" : undefined}
- // The session ends when focus leaves the pill entirely. Moving
- // between the two fields (or to the chevron) stays inside it, so a
- // half-typed side is never settled out from under the user.
- onBlur={(e) => {
- if (!e.currentTarget.contains(e.relatedTarget as Node)) endEditing();
<DropdownMenuSeparator />
<DropdownMenuSub>
<DropdownMenuSubTrigger>
@@ -583,6 +583,20 @@ export function TopBar({
</div>
</DropdownMenuSubContent>
</DropdownMenuSub>
+ </DropdownMenuContent>
+ );
+ return showCustomEditor ? (
+ <div
+ className={cn(
+ "aspect-switch flex items-center gap-1 rounded-full border bg-card px-3 py-1.5 text-xs font-medium shadow-xs",
+ customInvalid ? "border-destructive text-destructive" : "border-border"
+ )}
+ title={customInvalid ? "Up to an 8:1 shape" : undefined}
+ // The session ends when focus leaves the pill entirely. Moving
+ // between the two fields (or to the chevron) stays inside it, so a
+ // half-typed side is never settled out from under the user.
+ onBlur={(e) => {
+ if (!e.currentTarget.contains(e.relatedTarget as Node)) endEditing();
}}
onKeyDown={(e) => {
if (e.key === "Enter") commitCustom();
@@ -702,7 +716,7 @@ export function TopBar({
{!aiOpen && <ChatStatusBadge status={chatStatus} />}
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-48">
- {cutMode === "cloud" && (
+ {cutMode === "cloud" && !chatgpt && (
<DropdownMenuItem onClick={() => setShareOpen(true)}>
<Share2 /> Share
</DropdownMenuItem>
diff --git a/site/src/cut/lib/hostBridge.ts b/site/src/cut/lib/hostBridge.ts
new file mode 100644
index 00000000..28e0d597
--- /dev/null
+++ b/site/src/cut/lib/hostBridge.ts
@@ -0,0 +1,49 @@
+"use client";
+
+import { useEffect, useSyncExternalStore } from "react";
+import { editorHost } from "@/cut/lib/environment";
+
+/**
+ * The ChatGPT card and the editor it frames talk over postMessage. The card
+ * tells the frame which display mode the host is in and how tall the host's
+ * bottom overlay is; the frame keeps its bottom controls and the timeline's
+ * last rows above that band through `--host-inset-bottom`, and asks the card
+ * for fullscreen from its own toolbar. Outside the card nothing is sent and
+ * the variable stays unset.
+ */
+export type HostDisplayMode = "inline" | "fullscreen";
+
+let displayMode: HostDisplayMode = "inline";
+const listeners = new Set<() => void>();
+const subscribe = (listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener); }; };
+const read = () => displayMode;
+const readServer = (): HostDisplayMode => "inline";
+
+export function useHostDisplayMode() {
+ return useSyncExternalStore(subscribe, read, readServer);
+}
+
+export function requestHostFullscreen() {
+ if (editorHost() !== "chatgpt") return;
+ window.parent.postMessage({ type: "donkeycut:fullscreen" }, "*");
+}
+
+export function useHostBridge() {
+ useEffect(() => {
+ if (editorHost() !== "chatgpt") return;
+ const onMessage = (event: MessageEvent) => {
+ if (event.source !== window.parent) return;
+ const data = event.data as { type?: unknown; insetBottom?: unknown; displayMode?: unknown } | null;
+ if (data?.type !== "donkeycut:host") return;
+ if (typeof data.insetBottom === "number") {
+ const px = Math.max(0, Math.min(400, Math.round(data.insetBottom)));
+ document.documentElement.style.setProperty("--host-inset-bottom", `${px}px`);
+ }
+ const mode: HostDisplayMode = data.displayMode === "fullscreen" ? "fullscreen" : "inline";
+ if (mode !== displayMode) { displayMode = mode; listeners.forEach((l) => l()); }
+ };
+ window.addEventListener("message", onMessage);
+ window.parent.postMessage({ type: "donkeycut:host?" }, "*");
+ return () => window.removeEventListener("message", onMessage);
+ }, []);
+}
diff --git a/site/src/cut/lib/hostInset.ts b/site/src/cut/lib/hostInset.ts
deleted file mode 100644
index be907f0e..00000000
--- a/site/src/cut/lib/hostInset.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-"use client";
-
-import { useEffect } from "react";
-import { editorHost } from "@/cut/lib/environment";
-
-/**
- * Framed inside the ChatGPT card, the editor sits under the host's composer
- * in fullscreen. The card tells the frame how tall that band is, and the
- * editor keeps its bottom controls and the timeline's last rows above it
- * through `--host-inset-bottom`. Outside the card the variable stays unset.
- */
-export function useHostInset() {
- useEffect(() => {
- if (editorHost() !== "chatgpt") return;
- const onMessage = (event: MessageEvent) => {
- if (event.source !== window.parent) return;
- const data = event.data as { type?: unknown; insetBottom?: unknown } | null;
- if (data?.type !== "donkeycut:host-inset" || typeof data.insetBottom !== "number") return;
- const px = Math.max(0, Math.min(400, Math.round(data.insetBottom)));
- document.documentElement.style.setProperty("--host-inset-bottom", `${px}px`);
- };
- window.addEventListener("message", onMessage);
- window.parent.postMessage({ type: "donkeycut:host-inset?" }, "*");
- return () => window.removeEventListener("message", onMessage);
- }, []);
-}