fix(admin): 没有字体时不渲染「当前使用的字体」下拉
This commit is contained in:
@@ -2357,20 +2357,27 @@ function SystemPanel({
|
||||
|
||||
{font.source === 'custom' && (
|
||||
<>
|
||||
<FormField
|
||||
label="当前使用的字体"
|
||||
htmlFor="font-current"
|
||||
hint={font.items.length === 0 ? '还没有字体,先在下面添加一条' : '从已保存的字体里选一个启用'}
|
||||
>
|
||||
<Select
|
||||
options={font.items.map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name === '' ? item.key : item.name,
|
||||
}))}
|
||||
value={activeKey}
|
||||
onChange={(current) => update({ current })}
|
||||
/>
|
||||
</FormField>
|
||||
{/* 没有字体时不渲染下拉:空列表点开只会弹出一个空白面板 */}
|
||||
{font.items.length > 0 ? (
|
||||
<FormField
|
||||
label="当前使用的字体"
|
||||
htmlFor="font-current"
|
||||
hint="从已保存的字体里选一个启用"
|
||||
>
|
||||
<Select
|
||||
options={font.items.map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name === '' ? item.key : item.name,
|
||||
}))}
|
||||
value={activeKey}
|
||||
onChange={(current) => update({ current })}
|
||||
/>
|
||||
</FormField>
|
||||
) : (
|
||||
<Text size="sm" tone="muted">
|
||||
还没有字体,点下面的「添加字体」存一条,再回来选。
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{font.items.map((item) => (
|
||||
<div className="font-link" key={item.key}>
|
||||
|
||||
Reference in New Issue
Block a user