Skip to content

feat(web): add configurable enter behavior setting#586

Merged
tiann merged 1 commit into
tiann:mainfrom
junxin367:feat/issue-570-enter-behavior
May 7, 2026
Merged

feat(web): add configurable enter behavior setting#586
tiann merged 1 commit into
tiann:mainfrom
junxin367:feat/issue-570-enter-behavior

Conversation

@junxin367
Copy link
Copy Markdown
Contributor

概要

我根据 #570 在 Web 设置中增加了“回车键行为”设置,默认仍为“发送消息”,也可以切换为“插入换行”。

变更内容

  • 在设置页新增“聊天 / 回车键行为”配置项
  • 新增 useComposerEnterBehavior,使用 localStorage 持久化用户选择
  • HappyComposer 中接入两种输入模式:
    • send:Enter 发送,Shift+Enter 换行
    • newline:Enter 换行,Ctrl/Cmd+Enter 发送
  • 保持 IME 输入法处理和自动补全 suggestion 的 Enter 优先级不变
  • 补齐中英文 i18n 文案
  • 增加对应测试

验证

  • cd web && bun run test
  • cd web && bun run typecheck

Closes #570

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • No issues found with confidence >= 80% in the added/modified lines.

Summary

  • Review mode: initial
  • Reviewed the latest PR diff in full for the Web enter-behavior setting, including the new localStorage hook, settings UI wiring, i18n strings, and HappyComposer Enter handling. Residual risk: the added tests cover storage/options and settings rendering, but not the composer keydown behavior itself.

Testing

  • Not run (automation): bun is not installed in this runner image, so bun --cwd web run test -- src/hooks/useComposerEnterBehavior.test.ts src/routes/settings/index.test.tsx and bun --cwd web run typecheck could not execute.

HAPI Bot

@tiann tiann merged commit 08d3d9e into tiann:main May 7, 2026
2 checks passed
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.

'⏎' keystroke on mobile should be '\n' instead of enter

2 participants