Skip to content

feat(app): add copy and download actions to text file tabs - #60088

Open
dee-lienardy wants to merge 4 commits into
anomalyco:devfrom
dee-lienardy:file-view-actions
Open

dee-lienardy wants to merge 4 commits into
anomalyco:devfrom
dee-lienardy:file-view-actions

Conversation

@dee-lienardy

@dee-lienardy dee-lienardy commented Oct 29, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

  • New feature

What does this PR do?

Opening a text file in the file pane gave you no way to copy its content or save it. Non-text files already show a small toolbar with those actions, so I gave the code view the same toolbar instead of inventing a new UI. It reuses ArtifactToolbar, so text files get Copy content, Download, and Copy path with the existing styles and translations. The only change inside the toolbar is that mode, meta, and html became optional props, because the text view has no preview toggle or metadata.

There is also a keeper e2e in packages/app/e2e/regression/tabs.spec.ts that copies a file tab's content to the clipboard and downloads it.

Left out on purpose: the review diff preview header has no actions either. That can be a follow-up if wanted.

How did you verify your code works?

  • bun typecheck passes in packages/gui-plugins and packages/app.
  • bun script/lint-changed.ts origin/dev reports 0 problems.
  • The new Playwright test passes against the dev server. The clipboard ends up with the file content, and the download arrives named after the file.
  • Ran all of tabs.spec.ts. 36 passed. The 2 mobile drawer failures also fail on a clean dev checkout without this change.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72">
  <rect x="6" y="6" width="228" height="60" rx="6" fill="none" stroke="currentColor" stroke-opacity="0.3"/>
  <line x1="6" y1="25" x2="234" y2="25" stroke="currentColor" stroke-opacity="0.15"/>
  <rect x="16" y="13" width="44" height="5" rx="2.5" fill="currentColor" opacity="0.45"/>
  <g fill="none" stroke="currentColor">
    <rect x="193" y="10.5" width="8" height="8" rx="1.5" stroke-opacity="0.45"/>
    <rect x="196" y="13.5" width="8" height="8" rx="1.5" stroke-opacity="0.7"/>
  </g>
  <g fill="currentColor" opacity="0.6">
    <circle cx="212" cy="16.5" r="1.3"/>
    <circle cx="217" cy="16.5" r="1.3"/>
    <circle cx="222" cy="16.5" r="1.3"/>
  </g>
  <g fill="currentColor" opacity="0.18">
    <rect x="16" y="34" width="150" height="5" rx="2.5"/>
    <rect x="16" y="44" width="118" height="5" rx="2.5"/>
    <rect x="16" y="54" width="134" height="5" rx="2.5"/>
  </g>
  <g opacity="0" stroke="currentColor" fill="none">
    <circle cx="187" cy="15.5" r="6" fill="currentColor" fill-opacity="0.15" stroke="none"/>
    <path d="M184 15.5l2.2 2.2 4-4.5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    <animate attributeName="opacity" values="0;0;1;1;0;0" keyTimes="0;0.04;0.1;0.2;0.28;1" dur="4.8s" repeatCount="indefinite"/>
    <animateTransform attributeName="transform" type="translate" values="0 2;0 2;0 0;0 0;0 0;0 2" keyTimes="0;0.04;0.1;0.2;0.28;1" dur="4.8s" repeatCount="indefinite"/>
  </g>
  <g opacity="0" stroke="currentColor" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
    <path d="M215 30v8m0 0l-3-3m3 3l3-3"/>
    <path d="M210 41h10v4h-10z"/>
    <animate attributeName="opacity" values="0;0;1;1;0;0" keyTimes="0;0.45;0.53;0.7;0.8;1" dur="4.8s" repeatCount="indefinite"/>
    <animateTransform attributeName="transform" type="translate" values="0 -4;0 -4;0 0;0 0;0 2;0 -4" keyTimes="0;0.45;0.53;0.7;0.8;1" dur="4.8s" repeatCount="indefinite"/>
  </g>
</svg>

Screenshots / recordings

The new toolbar above a text file, and the File actions menu:

Text file tab with the copy and file actions toolbar

File actions menu with Download and Copy path

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #58878

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 29, 2026

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I checked it in the e2e harness: with this change a text file tab shows the toolbar, and Copy content and Download work. The new test passed 3 runs in a row and fails without the change. review, side-panels, mobile-plugins and tabs specs pass, apart from the two mobile drawer tests you mentioned. tsc -b in packages/gui-plugins is clean.

The toolbar handles the new optional props: the mode toggle and the "open in browser" entry stay hidden, and the code view keeps its scroll because the text is only read when a button is used.

Public API: unchanged (ArtifactToolbar is internal to gui-plugins).

No blocking concerns.

Related: #58878

Before

After

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commits only merge dev and don't touch the files this PR changes, so my earlier review still holds. At the new head, the copy/download e2e test still passes and tsc -b in packages/gui-plugins is clean. Public API: unchanged. No new concerns.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit only merges dev and doesn't touch the files this PR changes, so my earlier review still holds. At the new head, the copy/download e2e test still passes and tsc -b in packages/gui-plugins is clean. Public API: unchanged. No new concerns.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant