mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-26 14:32:22 +02:00
[eric] dashboard: clicks inside a webview page select its browser card (guest app-clicked IPC, select+raise only, no camera yank)
This commit is contained in:
@@ -369,8 +369,9 @@ const BrowserCard: React.FC<Props> = ({
|
||||
}),
|
||||
);
|
||||
} else if (e?.channel === 'app-clicked') {
|
||||
// First in-guest mousedown: a page click never reaches the host document, so this IPC is how a webview-content click marks this browser as last-interacted (drives Ctrl+R/zoom/tab targeting).
|
||||
// In-guest mousedown: a page click never reaches the host document, so this IPC is how a webview-content click marks this browser as last-interacted (drives Ctrl+R/zoom/tab targeting) and selected (spawn-beside anchor).
|
||||
setLastInteractedBrowser(browserId);
|
||||
window.dispatchEvent(new CustomEvent('openswarm:browser-guest-select', { detail: { browserId } }));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useRef, type Dispatch, type SetStateAction } from 'react';
|
||||
import React, { useCallback, useEffect, useRef, type Dispatch, type SetStateAction } from 'react';
|
||||
import { report } from '@/shared/serviceClient';
|
||||
import { useAppDispatch } from '@/shared/hooks';
|
||||
import { collapseSession, expandSession } from '@/shared/state/agentsSlice';
|
||||
@@ -89,6 +89,18 @@ export function useDashboardInteractions({
|
||||
dispatch(bringToFront({ id, type }));
|
||||
}, [dispatch]);
|
||||
|
||||
// A click INSIDE a webview's page never reaches the host DOM; BrowserCard forwards the guest's app-clicked IPC as this event. Select + raise only, no camera fit: you're clicking around inside the page, re-framing the canvas every tap would be hostile (same carve-out as the Workflows window).
|
||||
useEffect(() => {
|
||||
const onGuestSelect = (e: Event) => {
|
||||
const browserId = (e as CustomEvent).detail?.browserId;
|
||||
if (typeof browserId !== 'string' || !browserId) return;
|
||||
selection.selectCard(browserId, 'browser', false);
|
||||
dispatch(bringToFront({ id: browserId, type: 'browser' }));
|
||||
};
|
||||
window.addEventListener('openswarm:browser-guest-select', onGuestSelect);
|
||||
return () => window.removeEventListener('openswarm:browser-guest-select', onGuestSelect);
|
||||
}, [selection, dispatch]);
|
||||
|
||||
// ---- Viewport event handlers (compose pan + marquee) ----
|
||||
const handleViewportMouseDown = useCallback((e: React.MouseEvent) => {
|
||||
if (e.button === 1) {
|
||||
|
||||
Reference in New Issue
Block a user