Skip to content

Attach images pasted into the composer #91

Closed

Description

@iamnbutler

Pasting an image (for example, a screenshot copied with Cmd+Ctrl+Shift+4) into a chat composer doesn't attach it. Drag-and-drop and the paperclip file picker do attach images, so pasting should work too.

Cause

The rich-text editor's paste handler (packages/ui/src/components/rich-text/rich-text.tsx, getPaste) reads only text/uri-list and text/plain from clipboardData. It never checks clipboardData.files, so a pasted image never reaches the composer's onFiles, the path that drop (packages/ui/src/components/composer/composer.tsx) and the file input already use.

Expected

  • Pasting one or more images into a composer that allows attachments adds them, the same way dropping them does.
  • Pasting text still behaves as it does now, including turning a pasted URL into a link.
  • Composers with canAttach={false} ignore pasted files.

Part of #5.

Activity

  1. iamnbutler commented on Oct 5, 2026

    @iamnbutler
    ContributorAuthor

    Paused, with work in progress in the Ace lane image-paste-91 (branch brisk-grove/image-paste-91, based on origin/main 1ab91be). Nothing is committed or pushed yet, and there is no PR.

    • Change (2 files, +20): RichText takes an optional onFiles. Its paste handler sends image files from clipboardData.files there before the existing URL-link and plain-text handling runs. ChatComposer passes onFiles={attachable ? addFiles : undefined}, the same gate drop uses, so canAttach={false} and edit mode ignore pasted files.
    • Checks: bun types and bun run ci pass.
    • Not yet validated with a real clipboard in the UI. The lane's dev desktop build could only connect to an older installed Ace-dev helper (Dev app: reload action and reporting an open launch that exits early #97), and the supervisor paused desktop/clipboard testing. Still open: how mixed clipboards behave (text plus image, such as spreadsheet cells, and Finder file copies) in WebKit.
  2. iamnbutler commented on Oct 5, 2026

    @iamnbutler
    ContributorAuthor

    Resumed and in progress in the Ace lane image-paste-91 (branch brisk-grove/image-paste-91). Channel dev-paste-validation owns the test environment (#97 Ace-dev helper collision). This channel owns the code and the desktop/clipboard checks. Next: real paste checks in WebKit for images, plain text, URLs, multiline text, mixed text-and-image clipboards, canAttach={false}, and edit mode, then a PR.

  3. iamnbutler commented on Oct 5, 2026

    @iamnbutler
    ContributorAuthor

    PR #104 is open for review and not merged. It attaches pasted images through the existing useAttachments().add path. It keeps text whenever the clipboard has text/plain (spreadsheet and document copies), and it ignores pasted files when attachments are off. That also fixes a 0.0.11 bug where an image pasted into the dashboard composer was inserted into the editor as a raw <img>. I validated it in an Ace-dev build of the branch with real pasteboard contents; details are in the PR. The test environment has been cleaned up.

  4. iamnbutler commented on Oct 5, 2026

    @iamnbutler
    ContributorAuthor

    The known limit of #104 is now tracked in #105: a Finder copy of several images attaches only the first, because WebKit exposes only the first copied file. The native desktop-tool failures from validation are in githubnext/desktop-tools#5.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions