feat(composer): add delete button to QuoteChip for draft quote removal - #3200
feat(composer): add delete button to QuoteChip for draft quote removal#3200Battleplus wants to merge 23 commits into
Conversation
Add a small delete button (X icon) to QuoteChip that appears when an `onRemove` callback is provided. This allows users to quickly remove individual quotes from the composer draft without having to select and delete the atomic node. Changes: - Add `removeQuoteFromComposerDocument` to composerQuoteDocument.ts - Add `removeQuoteFromDraft` to composerDraftStore.ts - Add `onRemove` prop to QuoteChip component - Wire up delete button in ComposerQuoteNode to use editor commands The delete button: - Only appears on hover (opacity-0 → opacity-100) - Stops event propagation to prevent editor selection changes - Uses the editor's deleteRange command for proper undo support - Is positioned absolutely at top-right of the chip Refs makecindy#3172 Signed-off-by: Battleplus <3559424769@qq.com>
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/components/chat/QuoteChip.tsx | 保持引用 chip 为纯展示组件,并调整说明文字与引号实体。 |
| apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx | 在原子引用节点外层新增可悬停、可键盘操作且保留撤销能力的删除控件。 |
| apps/desktop/src/renderer/lib/composerDraftStore.ts | 新增从指定会话草稿移除匹配引用并保存更新文档的入口。 |
| apps/desktop/src/renderer/lib/composerQuoteDocument.ts | 新增依据文本与来源元数据移除引用节点并规范化空段落的文档转换函数。 |
Reviews (13): Last reviewed commit: "fix(quote-chip): use i18n for remove but..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47c279d71e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
这条 PR 改了输入框引用块的交互(草稿 QuoteChip 增加删除按钮),需要维护者确认后再合并。请维护者直接在本 PR 上 Approve;若要修改请 Request Changes,作者改完后再 Approve。讨论 issue:#3203 |
|
命中 UI 路径但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范。 这不是合并阻断,补上即可。 |
c83487e to
6924cd2
Compare
|
已修复 group-hover 问题:
现在 hover 到引用块时,右上角的 X 删除按钮会正确显示。请 re-review。 |
|
@Battleplus 👋 这个 PR 还有 4 条 review conversation 没 resolve(apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx / apps/desktop/src/renderer/components/chat/QuoteChip.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 537e1dd63a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@Battleplus 👋 这个 PR 还有 4 条 review conversation 没 resolve(apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx / apps/desktop/src/renderer/components/chat/QuoteChip.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
@Battleplus 👋 这个 PR 还有 5 条 review conversation 没 resolve(apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx / apps/desktop/src/renderer/components/chat/QuoteChip.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
MagicLizi
left a comment
There was a problem hiding this comment.
审查发现 1 个 P1。
apps/desktop/src/renderer/components/chat/QuoteChip.tsx:57
删除按钮用了 bg-[var(--surface-secondary)],主题系统没有注册这个 token(colors.ts 的 registerColor 列表里没有)。没有 fallback 时背景是透明的,键盘 focus 只看得到一个裸 ×。请换成已注册 token(例如 --surface-chip-alt 或 idle 用 --surface-hover)。
|
@Battleplus 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/components/chat/QuoteChip.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
已修复 review P1:删除按钮背景改用已注册的 --surface-hover-soft token,避免未注册的 --surface-secondary 在 Light/Dark 主题下解析为空。提交 7daa7a6,并已 resolve 对应 thread。 |
|
@Battleplus 👋 这个 PR 现在在等维护者确认,确认之前流程不会合并它 —— 不是卡住了,也不是在等你再改一版(你推的改动流程都读到了,判的就是最新一版代码)。
这条是流程自动发的状态提醒(同一版代码只发一次),不用回复。 |
|
补充记录:当前 Windows CI 失败为 packages/device-link 的 no link-accept / ACK 重发测试超时,属于与 QuoteChip 修改无关的基础设施/时序测试失败;QuoteChip 相关改动已通过 review,thread 为 0。 |
- Replace unregistered `--surface-secondary` with `--surface-chip-alt` (registered in themes/colors.ts) so the delete button has a visible background in all themes. - Add `group` to parent span and `group-hover:opacity-100` to the delete button so it becomes visible on chip hover instead of staying permanently invisible. Addresses MagicLizi P1 review on makecindy#3200. Signed-off-by: Battleplus <3559424769@qq.com>
7daa7a6 to
5a561ec
Compare
|
已在 head 1. 共享 Tip + 真实 2. 外层补 3. 死 API 删除 + 交互测试(讨论 #3203 第 3、4 项)
验证
|
这些问题已在当前 head 的后续 commit 中修复(格式门/安全门已通过),自动 dismiss 旧的 CHANGES_REQUESTED 以解除合并阻塞。
…remove APIs Address the 2026-09-06 changes-requested review on makecindy#3200: - ComposerQuoteNode: render the remove control as a real <button type="button"> wrapped in the shared Tip (text and aria-label both use chat.quote.remove), per DESIGN.md §14.6; no native title. - ComposerQuoteNode: add `relative` to the NodeViewWrapper so the absolutely positioned × anchors to its own chip instead of an outer containing block. - ComposerQuoteNode: no-op removal while the editor is locked (editor.setEditable(false)) so frozen drafts can't be mutated. - composerDraftStore / composerQuoteDocument: remove the unwired removeQuoteFromDraft() / removeQuoteFromComposerDocument() APIs and imports (discussion makecindy#3203 item 3). - composerChipPresentation.test.tsx: allow the close control only on the composer quote atom; add coverage for hover/focus visibility contract, click/Enter/Space removing only the clicked quote (identical attrs included), undo/redo restore, keydown not bubbling toward send, sent-message QuoteChip keeping no close button, and locked-editor no-op. Signed-off-by: Battleplus <3559424769@qq.com>
|
@Battleplus 👋 这个 PR 现在在等维护者确认,确认之前流程不会合并它 —— 不是卡住了,也不是在等你再改一版(你推的改动流程都读到了,判的就是最新一版代码)。
这条是流程自动发的状态提醒(同一版代码只发一次),不用回复。 |
|
CI 补充说明(head 当前仅剩 |
…control change The orca-workflow surface token/radius counts changed with the real <button> + Tip remove control in ComposerQuoteNode, so the GENERATED block no longer matched a fresh scan. Regenerated via node scripts/design-inventory.mjs on the branch merged with upstream main; --check and design-inventory.test.mjs pass. Signed-off-by: Battleplus <3559424769@qq.com>
…g-stable jsdom lacks Range.getClientRects/getBoundingClientRect; ProseMirror's focus/scrollIntoView coordsAtPos path hits them depending on rAF timing, which made the undo/redo case flake red on CI. Provide a minimal single-zero-rect implementation so scroll targeting takes the fallback path in tests. Signed-off-by: Battleplus <3559424769@qq.com>
|
@Battleplus 👋 这个 PR 目前与 请在本地 merge 最新的 |
3 similar comments
|
@Battleplus 👋 这个 PR 目前与 请在本地 merge 最新的 |
|
@Battleplus 👋 这个 PR 目前与 请在本地 merge 最新的 |
|
@Battleplus 👋 这个 PR 目前与 请在本地 merge 最新的 |
…-button Only conflict is docs/design-rules/design-inventory.md (regenerated on main); the doc is refreshed against the merged tree in the next commit. Signed-off-by: Battleplus <3559424769@qq.com>
The ledger conflicted with main because both sides regenerated the GENERATED block; re-ran node scripts/design-inventory.mjs on the branch merged with latest main (--check passes). Signed-off-by: Battleplus <3559424769@qq.com>
…-button Only conflict is docs/design-rules/design-inventory.md (regenerated on main again); the doc is refreshed against the merged tree in the next commit. Signed-off-by: Battleplus <3559424769@qq.com>
Re-ran node scripts/design-inventory.mjs on the branch merged with the latest main (--check passes). Signed-off-by: Battleplus <3559424769@qq.com>
…-button Only conflict is docs/design-rules/design-inventory.md (regenerated on main); the doc is refreshed against the merged tree in the next commit. Signed-off-by: Battleplus <3559424769@qq.com>
Re-ran node scripts/design-inventory.mjs on the branch merged with the latest main (--check passes). Signed-off-by: Battleplus <3559424769@qq.com>
…-button Three-way merge of PR-changed files with latest main. Signed-off-by: Battleplus <3559424769@qq.com>
Re-ran node scripts/design-inventory.mjs on the branch merged with the latest main (--check passes). Signed-off-by: Battleplus <3559424769@qq.com>
|
@Battleplus 👋 这个 PR 目前与 请在本地 merge 最新的 |
…-button Three-way merge of PR-changed files with latest main. Signed-off-by: Battleplus <3559424769@qq.com>
Re-ran node scripts/design-inventory.mjs on the branch merged with the latest main (--check passes). Signed-off-by: Battleplus <3559424769@qq.com>
…-button Three-way merge of PR-changed files with latest main. Signed-off-by: Battleplus <3559424769@qq.com>
Re-ran node scripts/design-inventory.mjs on the branch merged with the latest main (--check passes). Signed-off-by: Battleplus <3559424769@qq.com>
这次改了什么
摘要
为 composer 中的引用片段(QuoteChip)添加删除按钮,允许用户从 draft 中移除不需要的引用。
变更类型
fix缺陷修复feat新功能refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
怎么验证的
自动验证
手工验证
onRemove时不显示按钮未执行的验证
无
风险
风险分类
影响与回滚
提交前检查
Generated with Codebuff 🤖
Co-Authored-By: Codebuff noreply@codebuff.com