diff --git a/frontend/e2e/ux-followup.spec.js b/frontend/e2e/ux-followup.spec.js index 4fe1e62..e846ba6 100644 --- a/frontend/e2e/ux-followup.spec.js +++ b/frontend/e2e/ux-followup.spec.js @@ -31,6 +31,21 @@ test.describe('UX follow-up fixes', () => { await expect(page.locator('[data-global-search-results]')).toContainText('project-only.txt', { timeout: 10000 }); }); + test('global search folder results open the workspace Files context', async ({ page }) => { + const search = page.locator('[data-global-search-input]'); + await search.fill('Project/Notes'); + + const folderResult = page.locator('[data-global-search-result-type="Folder"][data-global-search-result-path="Project/Notes"]'); + await expect(folderResult).toBeVisible({ timeout: 10000 }); + await folderResult.click(); + + await expect(page.locator('.workspace-title')).toHaveText('Project', { timeout: 10000 }); + await expect(page.getByRole('tab', { name: 'Files' })).toHaveAttribute('aria-selected', 'true'); + await expect(page.locator('.files-root')).toBeVisible(); + await expect(page.locator('.files-breadcrumb')).toContainText('Notes'); + await expect(page.locator('.files-item')).toContainText('Overview.md'); + }); + test('plugin settings modal gives complex panels enough space', async ({ page }) => { await openPluginManager(page); await page.locator('.plugin-card').filter({ hasText: 'verstak.platform-test' }).getByRole('button', { name: 'Settings' }).click(); diff --git a/frontend/src/lib/shell/GlobalSearch.svelte b/frontend/src/lib/shell/GlobalSearch.svelte index 48d1567..c50db5a 100644 --- a/frontend/src/lib/shell/GlobalSearch.svelte +++ b/frontend/src/lib/shell/GlobalSearch.svelte @@ -180,6 +180,7 @@ rank: entry.type === 'folder' ? 30 : 40, action: entry.type === 'folder' ? 'file-folder' : 'file', path, + nodes, }); } @@ -209,6 +210,28 @@ })); return; } + if (item.action === 'file-folder') { + const parts = String(item.path || '').split('/').filter(Boolean); + const workspaceName = parts[0] || ''; + const localPath = parts.slice(1).join('/'); + if (workspaceName) { + window.__filesHistoryByWorkspace = window.__filesHistoryByWorkspace || {}; + window.__filesHistoryByWorkspace[workspaceName] = { + stack: [localPath], + index: 0, + currentPath: localPath, + }; + const detail = { workspaceName }; + if (Array.isArray(item.nodes) && item.nodes.length > 0) detail.nodes = item.nodes; + window.dispatchEvent(new CustomEvent('verstak:workspace-selected', { + detail + })); + window.dispatchEvent(new CustomEvent('verstak:workspace-open-tool', { + detail: { kind: 'files' } + })); + } + return; + } if (item.action === 'file') { const response = await App.OpenWorkbenchResource('verstak.search', { kind: 'vault-file', @@ -241,7 +264,13 @@