fix(knowledge): 阅读页正文列放宽,宽屏上不再留白比字多
CI / backend (push) Canceled after 0s

1440 的屏幕上 40rem 正文只有 640px,两边各空出半屏,用户直接发截图说"留白比内容都多"。
正文列 56rem(约 55 个汉字一行)、卡片 78rem,行宽到头但不用来回扫行。
e2e 的宽度断言跟着改成 720–920px,避免以后再窄回去没人拦。
This commit is contained in:
Steven
2026-11-03 12:23:53 +08:00
parent 35fdea7260
commit da31083df2
4 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
* 断言的是用户提的那件事,而不是"有个 drawer":
* ① 点卡片后 URL 变成 /w/<ws>/knowledge/<id>,列表页的元素不在了
* ② 正文渲染成样式(h2 存在),不是编辑器
* ③ 正文列的宽度 ≤ 46rem 且在内容区里居中(左右留白差不多)
* ③ 正文列限宽但别太窄(720–920px,约 50 来个汉字一行),且在内容区里居中
* ④ 点「编辑」才出现编辑器(抽屉),保存/取消都收回去
*/
import { chromium } from "playwright-core";
@@ -119,8 +119,8 @@ try {
const rightGap = main.x + main.width - (box.x + box.width);
const width = box.width;
check(
"正文列限宽到可读宽度(≤46rem≈736px)",
width <= 760,
"正文列宽度适合长文(720–920px,宽屏不留大片空白)",
width >= 720 && width <= 920,
`width=${Math.round(width)}`,
);
check(
+4 -2
View File
@@ -106,7 +106,9 @@ export function KnowledgeDocPage() {
return (
<AppShell wsId={wsId} active="knowledge">
<div className="mx-auto w-full max-w-[46rem]">
{/* 宽屏上别把正文挤成窄条:整块跟到 78rem,正文列限宽到 56rem(约 55 个汉字一行)。
再宽眼睛就要来回扫行了,留白比字长更难读。 */}
<div className="mx-auto w-full max-w-[78rem]">
<div className="mb-4 flex flex-wrap items-center gap-2">
<Link
to={`/w/${wsId}/knowledge`}
@@ -142,7 +144,7 @@ export function KnowledgeDocPage() {
</div>
) : (
<article className="card px-5 py-6 sm:px-8 sm:py-8">
<div className="mx-auto w-full max-w-[40rem]">
<div className="mx-auto w-full max-w-[56rem]">
<div className="flex flex-wrap items-center gap-1.5">
<span className="chip bg-primary-50 text-primary-700">
{DOC_TYPE_LABEL[doc.knowledge.doc_type] ?? doc.knowledge.doc_type}