Send enable-button message to click-to-component iframe (vibe-kanban) (#1075)

* 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
This commit is contained in:
Louis Knight-Webb
2025-10-22 11:10:20 +01:00
committed by GitHub
parent 85796360d3
commit ad854895fc

View File

@@ -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;