fix: 恢复二级设置页入口——点击插件行直达该插件配置页(有设置表单且已启动可点,开关区不穿透)
This commit is contained in:
@@ -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) => (
|
||||
<div key={p.manifest.id} className="flex items-center gap-3 rounded-card border border-line px-3 py-2.5">
|
||||
.map((p) => {
|
||||
const openSettings = p.hasSettings && p.enabled
|
||||
return (
|
||||
<div
|
||||
key={p.manifest.id}
|
||||
role={openSettings ? 'button' : undefined}
|
||||
tabIndex={openSettings ? 0 : undefined}
|
||||
onClick={openSettings ? () => 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' : ''
|
||||
}`}
|
||||
>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-[12.5px] font-medium text-ink">{p.manifest.name}</span>
|
||||
@@ -739,7 +762,11 @@ function PluginsPanel({
|
||||
)}
|
||||
{p.error && <div className="mt-1 text-[12px] text-red">装载失败:{p.error}</div>}
|
||||
</div>
|
||||
<div className="flex shrink-0 flex-col items-end gap-1">
|
||||
<div
|
||||
className="flex shrink-0 flex-col items-end gap-1"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onKeyDown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-[11px] text-ink-3">{p.enabled ? '已启动' : '已关闭'}</span>
|
||||
<button
|
||||
@@ -779,8 +806,9 @@ function PluginsPanel({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -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}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user