Skip to content

fix(web): make code block copy work over plain HTTP - #1714

Merged
wbxl2000 merged 1 commit into
mainfrom
codex/fix-web-code-block-copy
Jul 14, 2026
Merged

fix(web): make code block copy work over plain HTTP#1714
wbxl2000 merged 1 commit into
mainfrom
codex/fix-web-code-block-copy

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue; this is a focused, reproducible bug fix.

Problem

Code blocks rendered by markstream-vue silently skip the clipboard write when Kimi Web is served over plain HTTP and the browser does not expose navigator.clipboard. The component still shows its copied state, so users see successful feedback while the clipboard remains unchanged. The existing plain-HTTP fallback was only used by locally rendered diff blocks.

What changed

  • Handle the renderer's copy event and reuse Kimi Web's existing clipboard fallback when the Clipboard API is unavailable.
  • Skip the fallback when the renderer already copied through the Clipboard API, avoiding duplicate writes on secure origins.
  • Add a patch changeset for the CLI-bundled web UI.

Verification

  • pnpm --filter @moonshot-ai/kimi-web test -- clipboard.test.ts (28 files, 492 tests)
  • pnpm --filter @moonshot-ai/kimi-web typecheck
  • pnpm --filter @moonshot-ai/kimi-web build
  • pnpm --filter @moonshot-ai/kimi-web check:style (baseline mode, no new finding)
  • pnpm exec oxlint --type-aware apps/kimi-web/src/components/chat/Markdown.vue
  • Manual LAN HTTP browser check with isSecureContext=false and navigator.clipboard.writeText unavailable; clicking the code-block copy button wrote the exact code text to the clipboard.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • Existing tests and the manual browser check above prove the fix works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15e22d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@15e22d1
npx https://pkg.pr.new/@moonshot-ai/kimi-code@15e22d1

commit: 15e22d1

@wbxl2000
wbxl2000 merged commit 20b6972 into main Jul 14, 2026
15 checks passed
@wbxl2000
wbxl2000 deleted the codex/fix-web-code-block-copy branch July 14, 2026 14:31
@github-actions github-actions Bot mentioned this pull request Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant