私密/公开互斥兜底 + 智能体搜索按显示后名称匹配 + 多处小修
- 后端 update_agent / set_agent_private 增加兜底:is_private=true 时强制 published=false,杜绝同时落在公开+私密两个广场的灰色态 - agent-card 编辑弹窗暴露 editIsPrivate 开关,与公开发布开关在前端互斥校验 - agent-gallery 智能体模糊搜索改为前端针对 desensitize() 后的名字比对, 解决脱敏显示与原始名字不一致导致看似搜索失效的问题 - useUpdateAgent 在 onSuccess 立刻把新数据 patch 进所有 ["agents"] 列表 缓存,卡片在后台 refetch 完成前先行 re-render,避免「切换私密/发布后 好像没反应」的体感延迟 - useGlobalShortcuts 对 event.key 为 undefined(IME 合成 / 扩展注入)做 容错,否则会抛 TypeError 把后续所有快捷键吃掉 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c9c59b761f
commit
89a1fa5042
5 files changed
+130
-24
No files matched your search
@@ -19,11 +19,18 @@ interface Shortcut {
|
||||
export function useGlobalShortcuts(shortcuts: Shortcut[]) {
|
||||
useEffect(() => {
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
// ``event.key`` is ``undefined`` for synthetic / IME-composition /
|
||||
// some extension-injected keydown events. Calling ``.toLowerCase()``
|
||||
// on it throws and kills every shortcut after this one — bail out
|
||||
// before that happens.
|
||||
if (typeof event.key !== "string") return;
|
||||
const meta = event.metaKey || event.ctrlKey;
|
||||
const pressed = event.key.toLowerCase();
|
||||
|
||||
for (const shortcut of shortcuts) {
|
||||
if (typeof shortcut.key !== "string") continue;
|
||||
if (
|
||||
event.key.toLowerCase() === shortcut.key.toLowerCase() &&
|
||||
pressed === shortcut.key.toLowerCase() &&
|
||||
meta === shortcut.meta &&
|
||||
(shortcut.shift ?? false) === event.shiftKey
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user