[GH-ISSUE #3748] [GUI] pasting a screenshot with Ctrl+V does nothing in the message box #1574

Closed
opened 2026-11-04 01:52:21 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @xvcezrqpbxtpzblrt on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3748

Area

[GUI] (the desktop app)

Desktop app, Terminal or source?

Desktop app (Windows)

What happened

Copying a screenshot to the clipboard and pressing Ctrl+V in the message box does not attach it. Nothing appears in the composer: no thumbnail, no error, the box stays empty. Text paste still works, because the handler below only intercepts when it finds an image file.

The composer already has an image-paste handler, so pasting a screenshot is intended to work:

// host/dist/assets/index-DsqNG4H4.js (0.2.2)
onPaste: q => {
  const F = dGi(q.clipboardData);
  F.length && (q.preventDefault(),
    window.dispatchEvent(new CustomEvent("strata:drop-files", { detail: F })));
}

function dGi(t) {
  const c = [];
  for (const i of Array.from(t?.files ?? [])) {
    if (!i.type.startsWith("image/")) continue;
    const l = i.type.split("/")[1]?.replace("jpeg", "jpg").replace(/[+].*/, "") || "png";
    c.push(new File([i], `Pasted picture ....${l}`, { type: i.type }));
  }
  return c;
}

dGi only reads clipboardData.files. With a Win+Shift+S screenshot, that list is not yielding a file to this handler (the paste produces nothing), and the handler never looks at clipboardData.items or text/html. dGi returns [], the handler skips preventDefault(), and the screenshot is silently ignored.

The attach path itself is fine: the composer listens for strata:drop-files (window.addEventListener("strata:drop-files", Ws)) and adds the files (hs.current(Ls.detail ?? [])); the + file picker (accept="image/*,...", Cs(Array.from(files))) and drag-and-drop use the same path. Only the clipboard extractor is missing the items case.

Expected: Ctrl+V with an image on the clipboard attaches it to the composer, the same as the + picker and drag-and-drop. If there is no image, the normal text paste should happen. A missing image should not fail silently.

Possible fix (not tested): read clipboardData.items as well:

const files = [...(e.clipboardData?.items ?? [])]
  .filter(i => i.kind === "file" && i.type.startsWith("image/"))
  .map(i => i.getAsFile())
  .filter(Boolean);
const all = [...files, ...(e.clipboardData?.files ?? [])];

If items has no image, fall back to text/html / text/uri-list; only call preventDefault() when an image is found.

Smallest steps or command that reproduce it

  1. Copy a screenshot to the clipboard (Win+Shift+S, select an area).
  2. Open a chat in the desktop app and click the message box.
  3. Press Ctrl+V.
  4. Nothing is attached; the composer stays empty, with no error.

Expected: the screenshot is attached (thumbnail) and can be sent, like a file chosen with the + button.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.2 · engine 0.1.47

Graphics card, memory and system

RTX 3080 Ti Laptop 16 GB · 64 GB RAM · Windows 11 (10.0.26300)

Model, size and settings

Swift 1.5 IQ3_XXS · 384K context (the paste path is model-independent)

Logs

No engine log: this is client-side clipboard handling. Evidence from the installed 0.2.2 bundle host/dist/assets/index-DsqNG4H4.js:

  • the onPaste handler above; dGi iterates only clipboardData.files.
  • strata:drop-files is dispatched on paste; the composer listens for it and adds the files (hs.current(Ls.detail ?? [])), so the attachment path works when files are found.
  • the + file picker accepts image/* and adds images; drag-and-drop uses dataTransfer.files.
  • a Win+Shift+S screenshot does not reach dGi through clipboardData.files on this machine, and the handler does not inspect clipboardData.items.
Originally created by @xvcezrqpbxtpzblrt on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3748 ### Area [GUI] (the desktop app) ### Desktop app, Terminal or source? Desktop app (Windows) ### What happened Copying a screenshot to the clipboard and pressing Ctrl+V in the message box does not attach it. Nothing appears in the composer: no thumbnail, no error, the box stays empty. Text paste still works, because the handler below only intercepts when it finds an image file. The composer already has an image-paste handler, so pasting a screenshot is intended to work: ```js // host/dist/assets/index-DsqNG4H4.js (0.2.2) onPaste: q => { const F = dGi(q.clipboardData); F.length && (q.preventDefault(), window.dispatchEvent(new CustomEvent("strata:drop-files", { detail: F }))); } function dGi(t) { const c = []; for (const i of Array.from(t?.files ?? [])) { if (!i.type.startsWith("image/")) continue; const l = i.type.split("/")[1]?.replace("jpeg", "jpg").replace(/[+].*/, "") || "png"; c.push(new File([i], `Pasted picture ....${l}`, { type: i.type })); } return c; } ``` `dGi` only reads `clipboardData.files`. With a Win+Shift+S screenshot, that list is not yielding a file to this handler (the paste produces nothing), and the handler never looks at `clipboardData.items` or `text/html`. `dGi` returns `[]`, the handler skips `preventDefault()`, and the screenshot is silently ignored. The attach path itself is fine: the composer listens for `strata:drop-files` (`window.addEventListener("strata:drop-files", Ws)`) and adds the files (`hs.current(Ls.detail ?? [])`); the `+` file picker (`accept="image/*,..."`, `Cs(Array.from(files))`) and drag-and-drop use the same path. Only the clipboard extractor is missing the `items` case. Expected: Ctrl+V with an image on the clipboard attaches it to the composer, the same as the `+` picker and drag-and-drop. If there is no image, the normal text paste should happen. A missing image should not fail silently. Possible fix (not tested): read `clipboardData.items` as well: ```js const files = [...(e.clipboardData?.items ?? [])] .filter(i => i.kind === "file" && i.type.startsWith("image/")) .map(i => i.getAsFile()) .filter(Boolean); const all = [...files, ...(e.clipboardData?.files ?? [])]; ``` If `items` has no image, fall back to `text/html` / `text/uri-list`; only call `preventDefault()` when an image is found. ### Smallest steps or command that reproduce it 1. Copy a screenshot to the clipboard (Win+Shift+S, select an area). 2. Open a chat in the desktop app and click the message box. 3. Press Ctrl+V. 4. Nothing is attached; the composer stays empty, with no error. Expected: the screenshot is attached (thumbnail) and can be sent, like a file chosen with the `+` button. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.2 · engine 0.1.47 ### Graphics card, memory and system RTX 3080 Ti Laptop 16 GB · 64 GB RAM · Windows 11 (10.0.26300) ### Model, size and settings Swift 1.5 IQ3_XXS · 384K context (the paste path is model-independent) ### Logs No engine log: this is client-side clipboard handling. Evidence from the installed 0.2.2 bundle `host/dist/assets/index-DsqNG4H4.js`: - the `onPaste` handler above; `dGi` iterates only `clipboardData.files`. - `strata:drop-files` is dispatched on paste; the composer listens for it and adds the files (`hs.current(Ls.detail ?? [])`), so the attachment path works when files are found. - the `+` file picker accepts `image/*` and adds images; drag-and-drop uses `dataTransfer.files`. - a Win+Shift+S screenshot does not reach `dGi` through `clipboardData.files` on this machine, and the handler does not inspect `clipboardData.items`.
Author
Owner

@Niko1221 commented on GitHub (Oct 26, 2026):

Fixed in 0.2.5: a screenshot pasted with Ctrl+V is attached to the message.

<!-- gh-comment-id:6423179067 --> @Niko1221 commented on GitHub (Oct 26, 2026): Fixed in 0.2.5: a screenshot pasted with Ctrl+V is attached to the message.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1574
No description provided.