diff --git a/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte b/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte index 63acd8f678..436e51ef0e 100644 --- a/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppDrawer.svelte @@ -79,21 +79,39 @@ $focusedGrid = undefined }} > - {#if $app.subgrids?.[`${id}-0`]} - { - if (!$connectingInput.opened) { - $selectedComponent = [id] +
{ + e?.stopPropagation() + if (!$connectingInput.opened) { + $selectedComponent = [id] + $focusedGrid = { + parentComponentId: id, + subGridIndex: 0 } - }} - /> - {/if} + } + }} + > + {#if $app.subgrids?.[`${id}-0`]} + { + if (!$connectingInput.opened) { + $selectedComponent = [id] + $focusedGrid = { + parentComponentId: id, + subGridIndex: 0 + } + } + }} + /> + {/if} +
diff --git a/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte b/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte index f1bf84e0c3..be6e75027c 100644 --- a/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppSplitpanes.svelte @@ -29,7 +29,6 @@ } } - $: $selectedComponent?.includes(id) && onFocus() $: css = concatCustomCss($app.css?.containercomponent, customCss) $componentControl[id] = { diff --git a/frontend/src/lib/components/apps/components/layout/AppTabs.svelte b/frontend/src/lib/components/apps/components/layout/AppTabs.svelte index f584be1e38..468541df62 100644 --- a/frontend/src/lib/components/apps/components/layout/AppTabs.svelte +++ b/frontend/src/lib/components/apps/components/layout/AppTabs.svelte @@ -39,7 +39,7 @@ function handleTabSelection() { selectedIndex = tabs?.indexOf(selected) - outputs?.selectedTabIndex.set(selectedIndex, true) + outputs?.selectedTabIndex.set(selectedIndex) if ($focusedGrid?.parentComponentId != id || $focusedGrid?.subGridIndex != selectedIndex) { $focusedGrid = { @@ -127,6 +127,7 @@ on:focus={() => { if (!$connectingInput.opened) { $selectedComponent = [id] + handleTabSelection() } }} /> diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index bc28318902..5f964c6c89 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -73,8 +73,9 @@ hash: $page.url.hash } + const worldStore = buildWorld(context) setContext('AppViewerContext', { - worldStore: buildWorld(context), + worldStore, app: appStore, summary: summaryStore, selectedComponent, @@ -143,6 +144,8 @@ $: if ($selectedComponent?.[0] != befSelected) { befSelected = $selectedComponent?.[0] selectedTab = 'settings' + console.log('focusedGrid1', befSelected) + if (befSelected) { if (!['ctx', 'state'].includes(befSelected) && !befSelected?.startsWith('bg_')) { let item = findGridItem($appStore, befSelected) @@ -151,6 +154,12 @@ parentComponentId: befSelected, subGridIndex: 0 } + } else if (item?.data.type === 'tabscomponent') { + $focusedGrid = { + parentComponentId: befSelected, + subGridIndex: + ($worldStore.outputsById?.[befSelected]?.selectedTabIndex?.peak() as number) ?? 0 + } } else { let subgrid = findGridItemParentGrid($appStore, befSelected) if (subgrid) {