From aadd3adb2e7ad1b4290fa33a6997e6d0dd56947f Mon Sep 17 00:00:00 2001 From: Rick Ye Date: Fri, 11 Sep 2026 10:48:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=81=A2=E5=A4=8D=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5=E5=85=A5=E5=8F=A3=E2=80=94=E2=80=94?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=8F=92=E4=BB=B6=E8=A1=8C=E7=9B=B4=E8=BE=BE?= =?UTF-8?q?=E8=AF=A5=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE=E9=A1=B5=EF=BC=88?= =?UTF-8?q?=E6=9C=89=E8=AE=BE=E7=BD=AE=E8=A1=A8=E5=8D=95=E4=B8=94=E5=B7=B2?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=8F=AF=E7=82=B9=EF=BC=8C=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E5=8C=BA=E4=B8=8D=E7=A9=BF=E9=80=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../renderer/src/components/SettingsModal.tsx | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/apps/desktop/src/renderer/src/components/SettingsModal.tsx b/apps/desktop/src/renderer/src/components/SettingsModal.tsx index 8764bcc..5b6d428 100644 --- a/apps/desktop/src/renderer/src/components/SettingsModal.tsx +++ b/apps/desktop/src/renderer/src/components/SettingsModal.tsx @@ -635,6 +635,7 @@ function PluginsPanel({ onToggle, devBuild, onOpenDir, + onOpenSettings, onNavToggle }: { /** 正在切换中的插件 id(切换期间全部开关禁用,避免并发重建运行时) */ @@ -643,6 +644,8 @@ function PluginsPanel({ /** 开发版构建(第三方装载开关开启);用户版展示关闭提示 */ devBuild: boolean onOpenDir: (path: string) => void + /** 打开插件自己的二级配置页(点击插件行进入;仅已声明设置表单的插件可点) */ + onOpenSettings: (pluginId: string) => void /** 把设置入口固定/移出到设置页一级导航 */ onNavToggle: (pluginId: string, on: boolean) => void }): ReactNode { @@ -725,8 +728,28 @@ function PluginsPanel({ (a, b) => (a.manifest.order ?? 100) - (b.manifest.order ?? 100) || a.manifest.id.localeCompare(b.manifest.id) ) - .map((p) => ( -
+ .map((p) => { + const openSettings = p.hasSettings && p.enabled + return ( +
onOpenSettings(p.manifest.id) : undefined} + onKeyDown={ + openSettings + ? (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault() + onOpenSettings(p.manifest.id) + } + } + : undefined + } + className={`flex items-center gap-3 rounded-card border border-line px-3 py-2.5 ${ + openSettings ? 'cursor-pointer transition-colors hover:bg-hover' : '' + }`} + >
{p.manifest.name} @@ -739,7 +762,11 @@ function PluginsPanel({ )} {p.error &&
装载失败:{p.error}
}
-
+
e.stopPropagation()} + onKeyDown={(e) => e.stopPropagation()} + >
{p.enabled ? '已启动' : '已关闭'}
-
- ))} +
+ ) + })}
)}
@@ -1434,6 +1462,7 @@ export function SettingsModal({ onToggle={togglePlugin} devBuild={import.meta.env.DEV} onOpenDir={(path) => void window.api.openPath(path)} + onOpenSettings={(pluginId) => setTab(`plugin:${pluginId}`)} onNavToggle={handleSetSettingsNav} /> )}