Repository navigation
fix(web-ui): soft keyboard Enter inserts a line break instead of sending - #1141
Conversation
Mobile soft keyboards cannot send Shift+Enter, so the Enter (newline) key submitted the draft directly. On coarse-pointer inputs, plain Enter now falls through to Lexical's line break (the same path as Shift+Enter); the send button remains the submit gesture, and Ctrl/Cmd+Enter keeps the accelerated submit. fixes BytePioneer-AI#1118
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Summary
Merge Risk:
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | PR 标题描述了主要变更:在触摸设备(粗指针)上,软键盘的 Enter 键插入换行而不是发送消息。raw_summary 显示 keymap.ts 新增 isSoftKeyboardEnter(),在粗指针且未按 Ctrl/Meta 时返回 false,使 Lexical 插入换行。标题与变更一致,格式符合 conventional commit 风格。 | |
| Description check | PR 描述与变更相关:说明触摸输入上普通 Enter 改为换行,桌面端行为保持不变,并关联 issue #1118。描述与 raw_summary 中 keymap.ts 的改动一致。 |
|
| Linked Issues check | [#1118] 要求:手机软键盘换行键在光标处插入换行并保留草稿,提交通过发送按钮完成;桌面 Enter 发送和 Shift+Enter 换行可保持不变。证据:审查 keymap.ts 的差异(mergeBase a02ef3b 至 head 7835030)。新增 isSoftKeyboardEnter(),它在 window.matchMedia("(pointer: coarse)"… |
|
| Out of Scope Changes check | 差异仅修改 keymap.ts,新增 23 行。新增的 isSoftKeyboardEnter() 辅助函数和 Enter 分支中的粗指针判断,直接对应 #1118 的换行键问题。未发现与该问题无关的改动。IME 组合、菜单仲裁和 Ctrl/Cmd+Enter 相关逻辑在差异中未被修改。 |
Full details: Linked Issues check
-
Explanation
[
#1118] 要求:手机软键盘换行键在光标处插入换行并保留草稿,提交通过发送按钮完成;桌面 Enter 发送和 Shift+Enter 换行可保持不变。证据:审查 keymap.ts 的差异(mergeBase a02ef3b 至 head 7835030)。新增 isSoftKeyboardEnter(),它在 window.matchMedia("(pointer: coarse)") 为真时返回 true。在 Enter 提交分支中,若该条件成立且 ctrlKey、metaKey 均不为 true,代码返回 false,交由 Lexical 执行与 Shift+Enter 相同的换行路径。该分支位于 preventDefault 与 canSubmit 检查之前,因此不会提交草稿。
满足情况:粗指针输入下的普通 Enter 插入换行;发送按钮仍是提交方式;桌面(细指针)行为未改变;Ctrl/Cmd+Enter 仍提交。
剩余不确定点:差异中未包含自动化测试。该 issue 未明确要求测试,因此不作为未满足的编码要求。粗指针且带硬件键盘的设备(例如平板)上,普通 Enter 也不再提交,这是设计上的取舍,issue 未对其作出要求。
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
|
Thanks for fixing #1118! Before merging into |
Summary
fixes #1118