Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix(preview): fill available height in CSV and TSV views

CloudTianTiand78e2d54101b
diff --git a/src/renderer/style.css b/src/renderer/style.css
index fd34a8f8..ff4aaae2 100644
--- a/src/renderer/style.css
+++ b/src/renderer/style.css
@@ -19021,13 +19021,14 @@ body.is-task-side-panel-resizing * { cursor: col-resize !important; }
============================================================ */
/* CSV/TSV previews keep literal cell content in a bounded, scrollable grid. */
+.contexts-viewer-body:has(> .delimited-preview) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.delimited-preview { display: flex; flex-direction: column; flex: 1 1 auto; padding: 16px; min-width: 0; min-height: 0; }
.delimited-preview-toolbar { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 12px; color: var(--text-2); }
-.delimited-preview-scroll { overflow: auto; max-height: 70vh; }
+.delimited-preview-scroll { flex: 1 1 0; min-height: 0; overflow: auto; }
.delimited-preview table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13px; }
.delimited-preview td, .delimited-preview th { border: 1px solid var(--border); padding: 6px 10px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 70px; max-width: 480px; vertical-align: top; text-align: left; }
.delimited-preview th { position: sticky; left: 0; background: var(--surface-2); min-width: 35px; color: var(--text-2); font-weight: normal; }
-.delimited-preview .chat-file-viewer-text { padding: 0; min-height: 0; overflow: auto; max-height: 70vh; }
+.delimited-preview .chat-file-viewer-text { flex: 1 1 0; margin: 0; padding: 0; min-height: 0; overflow: auto; }
/* Keep code, addresses and native locale names legible in the Arabic UI. */
html[dir="rtl"] :is(pre, code, input[type="email"], input[type="url"]) {
diff --git a/test/e2e/files_e2e_formats.spec.ts b/test/e2e/files_e2e_formats.spec.ts
index 83d320af..88860477 100644
--- a/test/e2e/files_e2e_formats.spec.ts
+++ b/test/e2e/files_e2e_formats.spec.ts
@@ -43,6 +43,58 @@ test('CSV opens from task attachments and the Library without changing cell cont
{ timeout: 30_000 }).toBe('ready');
});
+test('CSV and TSV use the available preview height after resizing and switching to source', async ({ orkas }, info) => {
+ const page = orkas.page!;
+ const assertFilled = async (body: import('@playwright/test').Locator, selector: string) => {
+ await expect.poll(() => body.evaluate((container, selector) => {
+ const content = container.querySelector(selector)!;
+ const preview = container.querySelector('.delimited-preview')!;
+ const bottom = container.getBoundingClientRect().bottom
+ - parseFloat(getComputedStyle(container).paddingBottom)
+ - parseFloat(getComputedStyle(preview).paddingBottom);
+ return Math.abs(bottom - content.getBoundingClientRect().bottom);
+ }, selector)).toBeLessThanOrEqual(1);
+ expect(await body.locator(selector).evaluate(el => el.scrollHeight > el.clientHeight)).toBe(true);
+ };
+ for (const [name, delimiter] of [['height.csv', ','], ['height.tsv', '\t']]) {
+ const content = Array.from({ length: 30 }, (_, index) =>
+ [String(index + 1), '中文样本', `"${'Wide cell '.repeat(4)}\nSecond line"`,
+ ...Array.from({ length: 12 }, (_, column) => `field-${column}`)].join(delimiter)).join('\n');
+ const file = orkas.createWorkspaceFile(name, content);
+ const preview = await orkas.openPreview(() => page.evaluate(args =>
+ (window as any).openChatFileViewer(args.file, args.name), { file, name }));
+ await expect(preview.locator('.delimited-preview tr')).toHaveCount(30);
+ const native = await orkas.electronApp!.browserWindow(preview);
+ const body = preview.locator('.chat-file-viewer-body');
+ for (const [width, height] of [[960, 720], [620, 900]]) {
+ await native.evaluate((win, size) => win.setSize(size.width, size.height), { width, height });
+ await assertFilled(body, '.delimited-preview-scroll');
+ const scroll = body.locator('.delimited-preview-scroll');
+ expect(await scroll.evaluate(el => el.scrollWidth > el.clientWidth)).toBe(true);
+ await scroll.evaluate(el => { el.scrollTop = el.scrollHeight; el.scrollLeft = el.scrollWidth; });
+ await expect(preview.locator('.delimited-preview tr').last().locator('th')).toBeInViewport();
+ await preview.screenshot({ path: info.outputPath(`${name}-${height}.png`) });
+ await preview.locator('[data-delimited-toggle]').click();
+ await assertFilled(body, 'pre');
+ await expect(body.locator('pre')).toHaveText(content);
+ await preview.locator('[data-delimited-toggle]').click();
+ }
+ await orkas.closePreview(preview);
+
+ expect((await orkas.invoke<any>('contexts.upload', { path: name, data: Buffer.from(content).toString('base64') })).ok).toBe(true);
+ await page.locator('#contexts-btn').click();
+ await page.locator(`.ctx-tree-wrap[data-path="${name}"] > .skill-tree-node`).click();
+ const libraryBody = page.locator('#contexts-viewer-body');
+ await expect(libraryBody.locator('.delimited-preview tr')).toHaveCount(30);
+ await assertFilled(libraryBody, '.delimited-preview-scroll');
+ await libraryBody.locator('[data-delimited-toggle]').click();
+ await assertFilled(libraryBody, 'pre');
+ await expect(libraryBody.locator('pre')).toHaveText(content);
+ await expect.poll(async () => (await orkas.invoke<any>('kb.status')).files.find((f: any) => f.path === name)?.status,
+ { timeout: 30_000 }).toBe('ready');
+ }
+});
+
test('HTML attachments render offline interactions while the Library preserves editable source', async ({ orkas }, info) => {
const page = orkas.page!;
const source = readFileSync(path.resolve(__dirname, '../fixtures/files/sample.html'), 'utf8');