feat(webui): add reading text size preferences (#6325)

* feat(webui): add reading text size preferences

* fix(webui): align loading skeletons with reading typography
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-20 16:33:05 +08:00
1 parent 816c9221a0
commit 282839cc65
48 files changed
+662 -120

No files matched your search

@@ -593,8 +593,7 @@ function ActivityModelMessage({
<div
data-testid="activity-model-message"
data-assistant-selectable={active && message.isStreaming ? undefined : "true"}
className="w-full min-w-0 py-1 text-[15px]"
style={{ lineHeight: "var(--cjk-line-height)" }}
className="w-full min-w-0 py-1 text-reading"
>
<MarkdownText
streaming={active && !!message.isStreaming}
+1 -1
View File
@@ -178,7 +178,7 @@ export const PromptRail = memo(function PromptRail({ messages, prompts, onJumpTo
style={{ top: Math.max(60, Math.min(height - 60, padding + focused * GAP - scrollTop)) }}>
<div className="line-clamp-2 whitespace-pre-wrap break-words text-[15px] font-semibold leading-6">{preview.preview || preview.label}</div>
{preview.answerPreview ? <div className="mt-1.5 max-h-[4.5rem] overflow-hidden break-words text-sm leading-6 text-muted-foreground">
<MarkdownText className="max-w-none text-sm leading-6 prose-headings:my-0 prose-headings:text-sm prose-p:my-0">{preview.answerPreview}</MarkdownText>
<MarkdownText className="max-w-none prose-headings:my-0 prose-p:my-0">{preview.answerPreview}</MarkdownText>
</div> : null}
</div> : null}
</div>;
+12 -6
View File
@@ -143,6 +143,7 @@ import {
import { formatQuotedUserMessage } from "@/lib/user-message-quote";
import { cn } from "@/lib/utils";
import type { ComposerDraftStore } from "@/lib/composer-draft";
import { useLocalPreferences } from "@/hooks/useLocalPreferences";
const VOICE_SHORTCUT_CODE = "KeyD";
const VOICE_SHORTCUT_ARIA = "Control+Shift+D";
@@ -973,7 +974,7 @@ function GoalStateStrip({
id="nanobot-goal-panel-scroll"
className="min-h-0 flex-1 overflow-y-auto scrollbar-thin px-3 pb-3 pt-2"
>
<MarkdownText className="max-w-none text-[13.5px] leading-relaxed text-foreground/90">
<MarkdownText className="max-w-none text-foreground/90">
{markdownBody}
</MarkdownText>
</div>
@@ -1113,6 +1114,7 @@ export function ThreadComposer({
// Coarser than hasTouchPrimaryPointer on purpose: tablets with a physical
// keyboard still get the newline-on-Enter behavior.
const hasCoarsePointer = useMediaQuery("(pointer: coarse)");
const { readingTextSize } = useLocalPreferences();
const textareaRef = useRef<HTMLTextAreaElement>(null);
const mentionOverlayRef = useRef<HTMLDivElement>(null);
const formRef = useRef<HTMLFormElement>(null);
@@ -1751,6 +1753,10 @@ export function ThreadComposer({
if (mentionOverlayRef.current) mentionOverlayRef.current.scrollTop = el.scrollTop;
}, [compactControls, mentionInput.isComposing, mentionInput.value]);
useEffect(() => {
resizeTextarea(false);
}, [readingTextSize, resizeTextarea]);
// Runs before paint so switching sessions never flashes stale draft text.
useLayoutEffect(() => {
if (previousPendingQueueKeyRef.current === pendingQueueKey) return;
@@ -2470,15 +2476,15 @@ export function ThreadComposer({
) : null;
const inputTextClasses = cn(
// Keep the overlay's CJK/Latin spacing aligned with the native textarea caret.
"w-full resize-none bg-transparent [text-autospace:no-autospace]",
"w-full resize-none bg-transparent text-composer [text-autospace:no-autospace]",
compactControls
? "min-h-[52px] px-4 pb-2 pt-3 text-[16px] leading-6"
? "min-h-[52px] px-4 pb-2 pt-3"
: isHero
? cn(
"min-h-[78px] px-4 text-[16px] leading-6 sm:px-5",
"min-h-[78px] px-4 sm:px-5",
relaxedHeroInput ? "pb-2 pt-[27px]" : "pb-1.5 pt-4",
)
: "min-h-[50px] px-3.5 pb-1.5 pt-3 text-[16px] leading-5 sm:px-4",
: "min-h-[50px] px-3.5 pb-1.5 pt-3 sm:px-4",
);
const paletteBeside = showAnyPalette && slashPaletteLayout.placement === "beside";
@@ -2617,7 +2623,7 @@ export function ThreadComposer({
aria-label={t("thread.composer.quotedContext")}
>
<Quote className="mt-0.5 h-3.5 w-3.5 shrink-0" aria-hidden />
<p className="line-clamp-2 min-w-0 flex-1 text-[13px]/[1.45]">
<p className="line-clamp-2 min-w-0 flex-1 text-reading-small">
{normalizedQuotedContext}
</p>
<button
@@ -12,18 +12,6 @@ interface DiffSyntaxHighlightProps {
type RendererArgs = Parameters<NonNullable<SyntaxHighlighterProps["renderer"]>>[0];
type SyntaxNode = RendererArgs["rows"][number];
const CODE_FONT_STACK = [
'"JetBrains Mono"',
'"SFMono-Regular"',
'"SF Mono"',
'"Fira Code"',
'"Cascadia Code"',
'"Source Code Pro"',
"Menlo",
"Consolas",
"monospace",
].join(", ");
const LazyDiffSyntaxHighlight = lazy(async () => {
const [
{ default: SyntaxHighlighter },
@@ -50,18 +38,18 @@ const LazyDiffSyntaxHighlight = lazy(async () => {
margin: 0,
padding: 0,
overflow: "visible",
fontFamily: CODE_FONT_STACK,
fontSize: "11px",
lineHeight: "1.25rem",
fontFamily: "inherit",
fontSize: "inherit",
lineHeight: "inherit",
}}
codeTagProps={{
style: {
background: "transparent",
fontFamily: CODE_FONT_STACK,
fontFamily: "inherit",
},
}}
data-language={language}
className="code-content"
className="code-content font-mono text-code-dense"
data-testid="syntax-highlighted-diff-hunk"
renderer={({ rows, stylesheet, useInlineStyles }) => (
<DiffLineTable
@@ -110,7 +98,7 @@ function DiffLineTable({
renderCode: (line: RenderableFileDiffLine, index: number) => ReactNode;
}) {
return (
<table className="w-full border-collapse font-mono text-[11px] leading-5">
<table className="w-full border-collapse font-mono text-code-dense">
<tbody>
{lines.map((line, index) => (
<DiffLineRow