From ad854895fc1139616d47d91cd6b2c5f11d5eaa70 Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Wed, 22 Oct 2025 11:10:20 +0100 Subject: [PATCH] Send enable-button message to click-to-component iframe (vibe-kanban) (#1075) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Done! The changes have been implemented and all type checks pass: 1. ✅ Added `ClickToComponentEnableMessage` interface 2. ✅ Updated `ClickToComponentMessage` type to include `'enable-button'` 3. ✅ Modified the `'ready'` handler to send enable message back to iframe using `event.source` The parent will now automatically send the enable-button message when it receives ready from the iframe. * Cleanup script changes for task attempt f2d1a5b0-9c5b-4847-9fb8-f5851fca59d3 --- frontend/src/utils/previewBridge.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/previewBridge.ts b/frontend/src/utils/previewBridge.ts index e90d1988..501badc0 100644 --- a/frontend/src/utils/previewBridge.ts +++ b/frontend/src/utils/previewBridge.ts @@ -40,10 +40,16 @@ export interface OpenInEditorPayload { export interface ClickToComponentMessage { source: 'click-to-component'; version: number; - type: 'ready' | 'open-in-editor'; + type: 'ready' | 'open-in-editor' | 'enable-button'; payload?: OpenInEditorPayload; } +export interface ClickToComponentEnableMessage { + source: 'click-to-component'; + version: 1; + type: 'enable-button'; +} + export interface EventHandlers { onReady?: () => void; onOpenInEditor?: (payload: OpenInEditorPayload) => void; @@ -76,6 +82,14 @@ export class ClickToComponentListener { switch (data.type) { case 'ready': + if (event.source) { + const enableMsg: ClickToComponentEnableMessage = { + source: 'click-to-component', + version: 1, + type: 'enable-button', + }; + (event.source as Window).postMessage(enableMsg, '*'); + } this.handlers.onReady?.(); break;