技能 2026-10-16 07:54 UTC
cherry-studio
由提交人 DeJeune 提交,主要更新类型为:问题缺陷修复与稳定性提升。提交说明:hotfix(translate): keep dictation controls beside input text (#21825)。
Commit提交信息原文
hotfix(translate): keep dictation controls beside input text (#21825) <!-- Template from https://github.com/kubevirt/kubevirt/blob/main/.github/PULL_REQUEST_TEMPLATE.md?--> <!-- Thanks for sending a pull request! Here are some tips for you: 1. Consider creating this PR as draft: https://github.com/CherryHQ/cherry-studio/blob/main/CONTRIBUTING.md --> ### What this PR does Before this PR: Adding dictation to the translation input moved its controls into a full-width row, pushing the input text below the microphone and copy buttons. After this PR: Idle dictation and copy controls float beside the first text line, with space reserved so wrapped text cannot cover them. Active dictation controls retain their own space. A Playwright Electron regression checks the first-line alignment and non-overlap at 800px and 1280px with empty and long input. <!-- (optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: --> Fixes # N/A ### Why we need it and why it was done in this way The following tradeoffs were made: Only idle controls float; expanded recording and recovery controls remain in flow to avoid obscuring input. The pane subscribes to the idle boolean so recording timer updates do not rerender it. The following alternatives were considered: Always floating expanded controls could cover text. Keeping the added toolbar row wastes input space. The E2E checks rendered geometry instead of pinning CSS classes. Links to places where the discussion took place: <!-- optional: slack, other GH issue, mailinglist, ... --> None; reported with a screenshot in the workspace task. ### Breaking changes <!-- optional --> If this PR introduces breaking changes, please describe the changes and the impact on users. None. ### Special notes for your reviewer <!-- optional --> Validation on macOS: - `CS_DEV_PROFILE_ROOT=<isolated-profile> ELECTRON_RENDERER_URL=http://localhost:5174 pnpm exec playwright test tests/e2e/smoke/translateInputLayout.test.ts --reporter=list`: passed against the real Electron app. Restoring the original component makes the same test fail on the first-line layout assertion. - `pnpm test:renderer src/renderer/pages/translate/components/__tests__/TranslateInputPane.test.tsx src/renderer/pages/translate/__tests__/TranslatePage.test.tsx`: 67 tests passed. - `pnpm typecheck:web` and `pnpm typecheck:e2e`: passed. - Changed-file Oxfmt and Oxlint: passed. ESLint passed for the component; the repository excludes E2E files from ESLint. - Manual Electron verification covered empty/long input, expanded dictation controls, and return to idle. The automated E2E does not access the microphone or call a translation provider. Windows E2E and remote CI are not yet verified. No full local test suite was run. A user-guide update is not required for this layout correction. ### Checklist This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list. - [x] Branch: This PR targets `main` - [x] PR: The PR description is expressive enough and will help future contributors - [x] Code: [Write code that humans can understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans) and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle) - [ ] Refactor: You have [left the code cleaner than you found it (Boy Scout Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html) - [x] Upgrade: Impact of this change on upgrade flows was considered and addressed if required - [x] Documentation: A [user-guide update](https://docs.cherry-ai.com) was considered and is present (link) or not required. Check this only when the PR introduces or changes a user-facing feature or behavior. - [x] Self-review: I have reviewed my own code (e.g., via [`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`, or GitHub UI) before requesting review from others ### Release note <!-- Write your release note: 1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required". 2. If no release note is required, just write "NONE". 3. Only include user-facing changes (new features, bug fixes visible to users, UI changes, behavior changes). For CI, maintenance, internal refactoring, dev tooling, or other non-user-facing work, write "NONE". --> ```release-note <!--LANG:en--> [Translation] Keep idle dictation and copy buttons beside the input text without adding an extra toolbar row. <!--LANG:zh-CN--> [翻译] 修复听写和复制按钮额外占据一行的问题,空闲时保持在输入文字右侧。 <!--LANG:END--> ``` Signed-off-by: suyao <sy20010504@gmail.com>