diff --git a/src/renderer/src/i18n/zh.ts b/src/renderer/src/i18n/zh.ts index df9ddbca..46cf87c4 100644 --- a/src/renderer/src/i18n/zh.ts +++ b/src/renderer/src/i18n/zh.ts @@ -698,6 +698,7 @@ export const zh: Record = { "Working…": "处理中…", "Waiting for the {name} sign-in in your browser (check {check} of {checks}).": "正在等待你在浏览器中完成 {name} 登录(第 {check}/{checks} 次检查)。", "Stop waiting": "停止等待", + "People to mention": "可提及的人", "Layout": "布局", "View": "视图", "Run status": "运行状态", diff --git a/src/renderer/src/pages/chat/MentionTextarea.tsx b/src/renderer/src/pages/chat/MentionTextarea.tsx index ecadb095..ebb7587c 100644 --- a/src/renderer/src/pages/chat/MentionTextarea.tsx +++ b/src/renderer/src/pages/chat/MentionTextarea.tsx @@ -1,4 +1,5 @@ -import { useRef, useState, type MutableRefObject } from "react"; +import { t } from "../../i18n/i18n"; +import { useId, useRef, useState, type MutableRefObject } from "react"; import { Avatar } from "../../shared/ui"; import type { AgentRecord, EmployeeRecord } from "../../../../shared/domain"; import { canonicalMentionHandle } from "../../../../shared/mention-handles"; @@ -40,6 +41,7 @@ export function MentionTextarea({ }) { const [query, setQuery] = useState(null); const [index, setIndex] = useState(0); + const listId = useId(); const anchor = useRef(0); const innerRef = useRef(null); const ref = textareaRef ?? innerRef; @@ -52,6 +54,7 @@ export function MentionTextarea({ : []; const close = () => setQuery(null); + const open = !disabled && query !== null && filtered.length > 0; const insertMention = (handle: string) => { const node = ref.current; @@ -81,6 +84,8 @@ export function MentionTextarea({ }; const handleKeyDown = (event: React.KeyboardEvent) => { + // While an input method is composing, Enter and Tab confirm its text; they never pick a person or send. + if (event.nativeEvent.isComposing || event.keyCode === 229) return; if (query !== null && filtered.length > 0) { if (event.key === "ArrowDown") { event.preventDefault(); @@ -111,8 +116,8 @@ export function MentionTextarea({ return (
- {!disabled && query !== null && filtered.length > 0 && ( -
(