Files
MyGoNavi/frontend/src/utils/inputAutoCap.ts
Syngnat 5f7578c5ea feat(ai): 支持录制聊天发送快捷键
- 工具中心新增 AI 聊天发送快捷键,默认 Enter 并支持 Ctrl/Cmd/Alt+Enter
- AI 输入框按录制绑定发送,保留 Shift+Enter 换行和输入法 composing 保护
- 修复 shortcutOptions 启动刷新覆盖录制值的问题,并校验脏持久化快捷键
- 补充快捷键、输入框提示和持久化回归测试
- 撤回 macOS Caps Lock 浮层无效前端规避,恢复输入控件 no-auto-cap 属性
- 新增需求进度追踪文档记录验证结果
2026-04-28 18:12:42 +08:00

27 lines
777 B
TypeScript

export const noAutoCapInputProps = {
autoCapitalize: 'none' as const,
autoCorrect: 'off' as const,
spellCheck: false,
};
export const applyNoAutoCapAttributes = (element: Element) => {
const tagName = String((element as Element | null)?.tagName || '').toUpperCase();
if (tagName !== 'INPUT' && tagName !== 'TEXTAREA') {
return;
}
element.setAttribute('autocapitalize', 'none');
element.setAttribute('autocorrect', 'off');
element.setAttribute('spellcheck', 'false');
};
export const applyNoAutoCapAttributesWithin = (root: ParentNode | null | undefined) => {
if (!root || typeof root.querySelectorAll !== 'function') {
return;
}
root.querySelectorAll('input, textarea').forEach((element) => {
applyNoAutoCapAttributes(element);
});
};