mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-13 09:00:16 +00:00
## Summary - When a media node (LoadImage/LoadAudio/LoadVideo) is selected and the clipboard contains stale node metadata from a prior Ctrl+C, pasting skips the node-metadata deserialization so that the paste falls through to litegraph's default handler instead of incorrectly pasting the old copied node. - Fixes Comfy-Org/ComfyUI#12896 ## Root Cause The paste handler in `usePaste.ts` checks clipboard `text/html` for `data-metadata` (serialized node data) **before** falling through to litegraph's default paste. When a user copies a node, then copies a web image, the browser clipboard may retain the old `data-metadata` in `text/html` while the image data is not available as a `DataTransferItem` file. This causes the stale node to be pasted instead of the image. ## Fix Skip `pasteClipboardItems()` when a media node is selected, allowing the paste to fall through to litegraph's default handler which can handle the clipboard content appropriately. ## Test plan - [x] Added unit test verifying node metadata paste is skipped when media node is selected - [x] Manual: Copy a node → copy a web image → select LoadImage node → Ctrl+V → verify image is pasted, not the node ## AS IS https://github.com/user-attachments/assets/210d77d3-5c49-4e38-91b7-b9d9ea0e7ca0 ## TO BE https://github.com/user-attachments/assets/b68e4582-0c57-48b8-9ed9-0b3243bb1554 🤖 Generated with [Claude Code](https://claude.com/claude-code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9773-fix-skip-node-metadata-paste-when-media-node-is-selected-3216d73d3650814d92dadcd0c0ec79c7) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com>
48 lines
1.2 KiB
JSON
48 lines
1.2 KiB
JSON
{
|
|
"last_node_id": 2,
|
|
"last_link_id": 0,
|
|
"nodes": [
|
|
{
|
|
"id": 1,
|
|
"type": "LoadImage",
|
|
"pos": [50, 50],
|
|
"size": [315, 314],
|
|
"flags": {},
|
|
"order": 0,
|
|
"mode": 0,
|
|
"inputs": [],
|
|
"outputs": [
|
|
{ "name": "IMAGE", "type": "IMAGE", "links": null },
|
|
{ "name": "MASK", "type": "MASK", "links": null }
|
|
],
|
|
"properties": { "Node name for S&R": "LoadImage" },
|
|
"widgets_values": ["example.png", "image"]
|
|
},
|
|
{
|
|
"id": 2,
|
|
"type": "KSampler",
|
|
"pos": [500, 50],
|
|
"size": [315, 262],
|
|
"flags": {},
|
|
"order": 1,
|
|
"mode": 0,
|
|
"inputs": [
|
|
{ "name": "model", "type": "MODEL", "link": null },
|
|
{ "name": "positive", "type": "CONDITIONING", "link": null },
|
|
{ "name": "negative", "type": "CONDITIONING", "link": null },
|
|
{ "name": "latent_image", "type": "LATENT", "link": null }
|
|
],
|
|
"outputs": [{ "name": "LATENT", "type": "LATENT", "links": null }],
|
|
"properties": { "Node name for S&R": "KSampler" },
|
|
"widgets_values": [0, "randomize", 20, 8, "euler", "normal", 1]
|
|
}
|
|
],
|
|
"links": [],
|
|
"groups": [],
|
|
"config": {},
|
|
"extra": {
|
|
"ds": { "offset": [0, 0], "scale": 1 }
|
|
},
|
|
"version": 0.4
|
|
}
|