fix(webui): restore CJK line height and refine text wrapping

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-05 22:25:42 +08:00
1 parent 6ff96f2a8f
commit 24033152c7
3 files changed
+27 -12

No files matched your search

+2 -2
View File
@@ -78,7 +78,7 @@ const AlertDialogTitle = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title <AlertDialogPrimitive.Title
ref={ref} ref={ref}
className={cn("text-lg font-semibold", className)} className={cn("text-balance text-lg font-semibold", className)}
{...props} {...props}
/> />
)); ));
@@ -90,7 +90,7 @@ const AlertDialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description <AlertDialogPrimitive.Description
ref={ref} ref={ref}
className={cn("text-sm text-muted-foreground", className)} className={cn("text-pretty text-sm text-muted-foreground", className)}
{...props} {...props}
/> />
)); ));
+2 -2
View File
@@ -176,7 +176,7 @@ const DialogTitle = React.forwardRef<
<DialogPrimitive.Title <DialogPrimitive.Title
ref={ref} ref={ref}
className={cn( className={cn(
"text-lg font-semibold leading-none tracking-tight", "text-balance text-lg font-semibold leading-none tracking-tight",
className, className,
)} )}
{...props} {...props}
@@ -190,7 +190,7 @@ const DialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<DialogPrimitive.Description <DialogPrimitive.Description
ref={ref} ref={ref}
className={cn("text-sm text-muted-foreground", className)} className={cn("text-pretty text-sm text-muted-foreground", className)}
{...props} {...props}
/> />
)); ));
+23 -8
View File
@@ -120,6 +120,19 @@
body { body {
@apply bg-background text-foreground font-sans antialiased; @apply bg-background text-foreground font-sans antialiased;
overflow: hidden; overflow: hidden;
text-autospace: normal;
}
/* Keep source text and editable values visually literal. */
pre,
code,
kbd,
samp,
.font-mono,
input,
textarea,
[contenteditable="true"] {
text-autospace: no-autospace;
} }
#root.visual-viewport { #root.visual-viewport {
@@ -364,19 +377,21 @@
@apply list-none pl-0; @apply list-none pl-0;
} }
/* CJK-friendly line-height: prose paragraphs default to 1.625 which is /* Set the default before locale overrides: html also matches :lang(). */
tight for Chinese/Japanese/Korean characters. Bump to 1.8 for better :root {
readability when the browser detects a CJK primary font. */ --cjk-line-height: 1.625;
}
:lang(zh), :lang(zh),
:lang(zh-CN),
:lang(zh-TW),
:lang(zh-HK),
:lang(ja), :lang(ja),
:lang(ko) { :lang(ko) {
--cjk-line-height: 1.8; --cjk-line-height: 1.8;
} }
:root {
--cjk-line-height: 1.625; /* Balance short headings; preserve explicit line breaks in chat prose. */
.markdown-content :is(h1, h2, h3, h4, h5, h6),
.settings-section-title {
text-wrap: balance;
} }
/* L→R sheen clipped to live activity labels. The highlight lives inside /* L→R sheen clipped to live activity labels. The highlight lives inside