fix(frontend): make general-settings font picker actually work
The font picker in 常规设置 silently failed in three distinct ways: 1. Font family changes were invisible on macOS because 6 of the 7 options (Inter / Roboto / Segoe UI / Cascadia Code / JetBrains Mono / Fira Code) aren't installed by default and fell back to system SF. Swap the picker to a platform-aware list — Mac / Windows / Linux each see only the fonts their OS actually ships. The "third sans slot" now always serves a serif face (Georgia / Times New Roman / DejaVu Serif) so the difference is unambiguously visible instead of being three near-identical sans families. 2. Font size flipped --app-font-scale on <html>, but that variable was only consumed by a handful of TDesign tokens and the body reset, so the ~1000+ hard-coded font-size: NNpx rules across the frontend stayed put. Apply the multiplier via `zoom` on <html> so the whole document scales, then fix the 15 `100vh` rules that would overflow under zoom (html / body / #app are already height: 100%, so the descendants can use 100% too). 3. The monospace picker had no visible effect even on a working stack because `<t-input style="font-family: ...">` is forwarded to the inner <input>, but TDesign applies `font: var(--td-font-body-medium)` — a shorthand that resets font-family. Reach the real <input> / <textarea> via `:deep()` instead of inline style. Additional polish: - Add a live preview row under each picker so users can see the effect without hunting for a code block or API Info screen - Rename "等宽字体 / Monospace Font" → "代码字体 / Code Font" to match VSCode / GitHub / Notion convention; the old label was jargon - Rewrite descriptions to explain the actual purpose and scope
This commit is contained in:
@@ -162,7 +162,8 @@
|
||||
@blur="handleSystemPromptChange"
|
||||
@input="handlePromptInput"
|
||||
@keydown="handlePromptKeydown"
|
||||
style="width: 100%; font-family: var(--app-font-family-mono); font-size: 13px;"
|
||||
class="mono-text-input"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<PromptTemplateSelector
|
||||
type="agentSystemPrompt"
|
||||
@@ -220,7 +221,8 @@
|
||||
:autosize="{ minRows: 10, maxRows: 20 }"
|
||||
:placeholder="$t('conversationSettings.systemPrompt.placeholder')"
|
||||
@blur="handleSystemPromptNormalChange"
|
||||
style="width: 100%; font-family: var(--app-font-family-mono); font-size: 13px;"
|
||||
class="mono-text-input"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<PromptTemplateSelector
|
||||
type="systemPrompt"
|
||||
@@ -246,7 +248,8 @@
|
||||
:autosize="{ minRows: 15, maxRows: 30 }"
|
||||
:placeholder="$t('conversationSettings.contextTemplate.placeholder')"
|
||||
@blur="handleContextTemplateChange"
|
||||
style="width: 100%; font-family: var(--app-font-family-mono); font-size: 13px;"
|
||||
class="mono-text-input"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<PromptTemplateSelector
|
||||
type="contextTemplate"
|
||||
@@ -1749,6 +1752,16 @@ const handleConversationRerankModelChange = async (value: string) => {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// TDesign's <t-input>/<t-textarea> forwards `style=""` to its wrapper but
|
||||
// applies `font: var(--td-font-body-medium)` (a shorthand) to the inner
|
||||
// <input>/<textarea>, which silently resets font-family. Reach into those
|
||||
// elements explicitly so the code font takes effect for prompt editors.
|
||||
.mono-text-input :deep(input),
|
||||
.mono-text-input :deep(textarea) {
|
||||
font-family: var(--app-font-family-mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
.section-header {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user