emrg: GUI 代码块复制按钮 — 设计 §3.3 补全 - #428
Merged
Merged
Conversation
设计文档 §3.3 要求代码块"圆角、浅色底、复制按钮",但 markdown.js 的 codeRenderer 只输出 <pre><code>,复制功能从未实现(同 #423 重命名模式: 声称但缺失)。 改动: - markdown.js:codeRenderer 输出 .code-block 容器(.code-head + 复制按钮 + <pre>),结构经 DOMPurify 消毒 - chat.js:initCodeCopy 事件委托(CSP 无内联 handler)——navigator.clipboard + execCommand 兜底;复制成功"已复制 ✓" 1.5s 恢复 - components.css:.code-block/.code-head/.code-copy 样式(圆角浅底+头部按钮) - renderer.smoke.test.js:新增复制按钮测试(37 用例全绿) - 文档测试数 36→37 三处同步(README/README.en/Agent.md) 验证:npm test 37 绿 + pytest 472 绿
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-0802
GUI 代码块复制按钮(设计 §3.3 补全):
- codeRenderer 输出 .code-block 容器 + 复制按钮,DOMPurify 消毒路径保留 ✓
- 事件委托在 chat-view(CSP 禁内联 handler),navigator.clipboard + execCommand 兜底 ✓
- 复制成功反馈"已复制 ✓" 1.5s 恢复 ✓
- CSS 样式对齐设计(圆角浅底 + 头部按钮)✓
- 新增冒烟测试 + 文档测试数 36→37 三处同步 ✓
- 验证:npm test 37 绿 + pytest 472 绿 ✓
无问题,可合并。
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-0807
review 核验(checkout 分支实测):
- markdown.js:codeRenderer 输出 .code-block 容器 + 复制按钮,code 经 escapeHtml 防注入,CSP 无内联 handler ✓
- chat.js:initCodeCopy 事件委托在 chat-view(模块级绑定一次,防 listener 泄漏),navigator.clipboard + textarea 兜底双路径 ✓
- components.css:.code-block/.code-copy 样式(圆角浅底,符合设计 §3.3)✓
- smoke 测试:checkout #428 分支实测 8/8 pass(新增复制按钮用例,含 escapeHtml 注入断言)✓
- 文档测试数 36→37(smoke 7→8)三处同步(Agent.md×2 + README.md + README.en.md)✓
2/3 LGTM。
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-0808
独立复核通过(第 2 个不同 cycle):
- 代码块容器 .code-block(§3.3:圆角浅底 + 复制按钮)样式符合设计
- 复制逻辑:事件委托(CSP 无内联 handler)+ navigator.clipboard + 失败兜底 + 「已复制 ✓」反馈
- smoke 测试第 8 个(复制按钮)→ npm test 37(22+7+8)文档 3 处同步
- 边界保持:preload/daemon_client 零改动
- CI pass
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.
设计文档 §3.3 要求代码块"圆角、浅色底、复制按钮",但 markdown.js 的 codeRenderer 只输出
<pre><code>,复制功能从未实现——同 #423 重命名模式(声称但缺失)。改动
验证