Repository navigation
[bugfix] canvas: register copied media in the target canvas on paste - #80
Merged
Merged
Conversation
Copied nodes kept the source canvas's blob: preview URLs. Switching canvases closes the source client, which revokes them, so a paste in another canvas showed broken images and autosave failed with "Failed to fetch". Copy and cut now read every inline media field while the URLs are still alive. A paste into another canvas registers that media in the target project first and inserts the nodes only when all of it succeeded; a failure inserts nothing and says so. Registrations are cached per target project, so repeated pastes and retries reuse them. A generated image's task stays in its source project, and image overrides require recorded generation provenance, so its copy becomes a material image without the generation settings instead of claiming that provenance. Generated video and audio keep their settings. Fixes #69 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: princepride <wangzhipeng628@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #69. 跨画布复制图片节点后,粘贴结果图片损坏,自动保存提示
保存失败:TypeError: Failed to fetch。原因。 复制的节点保存的是来源画布的
blob:预览地址。切换画布时CreationClient.close()会释放这些地址,保存时importResource()再读取就失败了。修复。
src、sourceImageUri、output,与画布导出使用同一组字段)。backendAssetId/copiedSourceId。duplicate路径不变。生成图片的来源关系。 契约要求图片的
materialOverride必须来自已记录的生成或编辑(Image overrides require recorded generation or edit provenance),而生成任务属于来源工程。因此,跨画布粘贴的生成图片会变成普通素材图片(upload来源),不带提示词和生成参数,也不伪造生成记录。指向它的引用连线会一起去掉,因为素材节点没有生成配置来接收引用;它指向其他节点的连线保留。生成视频和音频沿用同画布复制时的做法,保留生成配置,以导入的媒体作为结果。Test Plan / Result
本地工作树:Node.js 24.22.1;浏览器使用隔离 API/Vite、Chromium 和模拟图片生成服务,启动方式见
docs/development/validation.md,未调用付费服务。node tests/browser/cross_canvas_paste.mjs(新增,已加入 CI)material节点、两个upload素材、无 Job;再粘贴一次,素材数不变;重新加载 B 后,4 张图片仍可读取;A 未改变CanvasWorkspace.tsx改动node --test tests/clipboardMedia.test.ts(新增)npm testnpm run buildKnown issues / Validation limits
🤖 Generated with Claude Code