Skip to content

Studio Code: accept image paste anywhere in the view - #4208

Merged
sejas merged 4 commits into
trunkfrom
stu-1894-studio-code-support-pasting-images-into-the-composer-default
Jul 16, 2026
Merged

Studio Code: accept image paste anywhere in the view#4208
sejas merged 4 commits into
trunkfrom
stu-1894-studio-code-support-pasting-images-into-the-composer-default

Conversation

@sejas

@sejas sejas commented Jul 15, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

AI was used to trace the existing attachment pipeline, draft the change, and write the accompanying unit tests. The result was reviewed and verified manually.

Proposed Changes

Pasting an image into the Studio Code composer already works since #3925 — but only while the textarea itself is focused.

This PR makes both composers — the classic Studio Code tab (apps/studio) and the agentic UI session view (apps/ui) — accept image and file pastes globally anywhere in the conversation.

  • Pasting an image (or file) while focus is anywhere in the Studio Code view attaches it and focuses the composer, ready to type.
  • Pasting while the textarea is focused behaves exactly as before (no double-attach).
  • Pastes inside open dialogs are left untouched, so modal inputs keep their normal paste behavior.
  • Plain-text paste is unaffected everywhere.

The existing attachment limits (4 images, 5 MB per image, 12 MB total) apply unchanged.

Testing Instructions

  1. Open a site → Studio Code tab, signed in to WordPress.com.
  2. Take a screenshot to the clipboard (⌃⇧⌘4 on macOS).
  3. Click somewhere in the conversation area (so the textarea is not focused), then press ⌘V → the image appears as an attachment chip and the textarea gains focus.
  4. Press ⌘V again with the textarea focused → exactly one more chip appears (no duplicates).
  5. Open the model-switch confirmation dialog (pick a model from another family) and paste → nothing is attached.
  6. Send a message with a pasted image → the agent receives it.
  7. Repeat steps 2–6 in the agentic UI (Feature flags → enable Agentic UI) session view.
copy-paste-iamge-agentic.mp4
copy-paste-image-classic.mp4

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Jul 15, 2026
@sejas
sejas marked this pull request as ready for review July 16, 2026 11:12
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 1f8d0ef vs trunk

app-size

Metric trunk 1f8d0ef Diff Change
App Size (Mac) 1352.96 MB 1352.96 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 1f8d0ef Diff Change
load 1097 ms 1067 ms 30 ms ⚪ 0.0%

site-startup

Metric trunk 1f8d0ef Diff Change
siteCreation 6994 ms 7013 ms +19 ms ⚪ 0.0%
siteStartup 2364 ms 2357 ms 7 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim bcotrim 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.

LGTM 👍

@sejas
sejas merged commit 9a5f8b4 into trunk Jul 16, 2026
12 checks passed
@sejas
sejas deleted the stu-1894-studio-code-support-pasting-images-into-the-composer-default branch July 16, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants