Repository navigation
Conversation
…oard Ctrl/Cmd+C on the canvas only filled the in-app clipboard, so a copied image node could not be pasted into an email draft, chat composer or slide editor. When exactly one text or image node is copied, also write its plain text or PNG image data to the system clipboard, reusing the bytes the in-app copy already captures. The write starts inside the shortcut's user activation and success is reported only after the platform accepts it; missing media, unsupported browsers and rejected writes show bilingual messages that keep the in-app copy and suggest downloading instead. In-app paste is unchanged. The desktop session denied every permission, which also blocked clipboard writes; it now grants clipboard-sanitized-write only. Fixes ThinkFlowLab#474.
wangtiance
left a comment
There was a problem hiding this comment.
这份 PR 把画布内的节点复制和系统剪贴板写入分开,保留了内部粘贴行为。我审了 0035b51 的代码和测试,有两处建议在交付前处理。
-
把桌面剪贴板授权限制在应用页面。
apps/desktop/src/main.mjs目前只按权限名称放行,没有校验请求来源,也没有设置对应的 permission check handler。建议和 #458 共用同一套按来源校验的策略,确保只为opendirector://app授予所需的写入能力。请在实际 Electron 安装包中按 Ctrl/Cmd+C 分别复制文本和图片,再粘贴到外部应用。当前的 mock 测试覆盖了写入参数,但没有验证键盘手势和 Electron 权限回调是否能走通。 -
给缺失图片显示明确的回退提示。
systemClipboardPayload在检查assetState === "missing"前就因为src为空返回null,随后只显示普通的“已复制”提示。当前测试给缺失节点填了blob:gone,没有覆盖无src的情况。建议先处理缺失状态,让这条路径明确提示只能在画布内粘贴,并补一个对应的测试。
建议把描述里的 Fixes #474 改成 Refs #474,让视频回退、双向粘贴和跨客户端可编辑内容继续留在原 issue 跟踪。当前提交的检查接口只返回了 reviewer routing 成功。我没有看到 Windows/macOS 安装包或 Web 与外部应用互贴的验收结果。
Grant clipboard-sanitized-write only to opendirector://app in both the Electron permission request and check handlers, and give missing image nodes without a src the in-app-only copy notice.
|
@wangtiance 感谢审阅,两处都已处理:
验证:Ran 我已把 PR 描述中的 |
wangtiance
left a comment
There was a problem hiding this comment.
复核了 2338e58。上轮两条代码意见都已处理。Electron 的请求和检查回调现在共用来源校验,只有应用自身的来源可写入剪贴板。缺失图片即使没有 src 也会走画布内复制的提示,并补了对应测试。Refs #474 也让剩余场景可以继续在原 issue 跟踪。
当前提交的 Release checks 和 Desktop checks 都显示 action_required,尚未看到通过结果。请有权限的维护者查看 Actions 页面上的处理提示。真实 Windows/macOS 安装包里用 Ctrl/Cmd+C 复制文本和图片,再粘贴到外部应用的验证也仍待完成。本次复核依据代码和远程检查状态。
Summary
en-USandzh-CNsays the copy only works on the canvas and suggests downloading the asset instead.clipboard-sanitized-writeonly. Clipboard reads and all other permissions stay denied.Scope note: this covers the main scenario in the issue, copying an image or text node out to other apps. It does not cover copying video to the clipboard with a download fallback, keeping nodes editable when copying between Web and desktop clients, or the manual checks across operating systems. Those remain follow-up work, and maintainers may prefer to treat this PR as
Refs #474.Linked issue
Refs #474
Fixes #NorRefs #Nis included, or no issue appliesLabels
Suggested:
type:feat,area:canvas,area:desktop.Test plan
npm testin a clean Linux container: passed.New unit tests in
tests/systemClipboard.test.tsuse a stand-in clipboard. They cover Chinese and English text with line breaks, the PNG image write, multi-node and empty selections staying in-app, and localized errors for missing media, a rejected write and missingClipboardItemsupport.Evidence that it works
Provider verification
Bilingual UI
This PR was prepared with AI assistance (Claude) and reviewed by me before submitting.