diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 265a9ff8..3d0b2c94 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -209,7 +209,7 @@ jobs: ' icon: path.join(__dirname, \\'../build/icon.png\\'),\\n' + ' titleBarStyle: \\'default\\', // 使用默认标题栏,避免重叠问题\\n' + ' show: false,\\n' + - ' autoHideMenuBar: true, // 隐藏菜单栏\\n' + + ' autoHideMenuBar: false, // 显示菜单栏,确保编辑快捷键行为一致\\n' + ' frame: true, // 保持窗口框架\\n' + ' backgroundColor: \\'#ffffff\\', // 设置背景色,避免白屏闪烁\\n' + ' titleBarOverlay: false, // 禁用标题栏覆盖\\n' + @@ -281,9 +281,21 @@ jobs: ' mainWindow.once(\\'ready-to-show\\', () => {\\n' + ' mainWindow.show();\\n' + ' });\\n\\n' + - ' // 提供稳定的 DevTools 入口(生产环境)\\n' + + ' // 提供稳定的菜单与编辑快捷键(生产环境)\\n' + ' const menuTemplate = [\\n' + ' {\\n' + + ' label: \\'Edit\\',\\n' + + ' submenu: [\\n' + + ' { role: \\'undo\\' },\\n' + + ' { role: \\'redo\\' },\\n' + + ' { type: \\'separator\\' },\\n' + + ' { role: \\'cut\\' },\\n' + + ' { role: \\'copy\\' },\\n' + + ' { role: \\'paste\\' },\\n' + + ' { role: \\'selectAll\\' }\\n' + + ' ]\\n' + + ' },\\n' + + ' {\\n' + ' label: \\'View\\',\\n' + ' submenu: [\\n' + ' { role: \\'reload\\' },\\n' + diff --git a/src/components/LoginScreen.tsx b/src/components/LoginScreen.tsx index 5cdad133..8299d4dd 100644 --- a/src/components/LoginScreen.tsx +++ b/src/components/LoginScreen.tsx @@ -40,9 +40,24 @@ export const LoginScreen: React.FC = () => { } }; - const handleKeyPress = (e: React.KeyboardEvent) => { + const handleKeyPress = async (e: React.KeyboardEvent) => { if (e.key === 'Enter' && !isLoading) { handleConnect(); + return; + } + + // 兼容桌面端首次登录场景下 Ctrl/Cmd + V 无法触发默认粘贴的问题 + if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'v' && !isLoading) { + try { + const text = await navigator.clipboard.readText(); + if (text) { + setToken(text.trim()); + setError(''); + } + } catch (error) { + // 忽略读取剪贴板失败,让浏览器/系统默认行为继续兜底 + console.warn('Clipboard read failed:', error); + } } }; diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index 0b3ecdf8..419a0df2 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'; import { Search, Filter, X, SlidersHorizontal, Monitor, Smartphone, Globe, Terminal, Package, CheckCircle, Bell, BellOff, Apple, Bot } from 'lucide-react'; import { useAppStore } from '../store/useAppStore'; import { AIService } from '../services/aiService'; +import { useSearchShortcuts } from '../hooks/useSearchShortcuts'; export const SearchBar: React.FC = () => { @@ -509,6 +510,23 @@ export const SearchBar: React.FC = () => { const t = (zh: string, en: string) => language === 'zh' ? zh : en; + // 全局快捷键支持(Ctrl/Cmd+K、Ctrl/Cmd+Shift+F、/、Escape) + useSearchShortcuts({ + onFocusSearch: () => { + searchInputRef.current?.focus(); + if (!searchQuery && searchHistory.length > 0) { + setShowSearchHistory(true); + } + }, + onClearSearch: () => { + handleClearSearch(); + searchInputRef.current?.focus(); + }, + onToggleFilters: () => { + setShowFilters(prev => !prev); + }, + }); + return (
{/* Search Input */}