feat(knowledge): 「全部」排到 tab 第一位并默认选中,正文编辑区跟着屏高走
CI / backend (push) Canceled after 0s

- 知识列表 tab 顺序改成 全部 / 待核对 / 已发布 / 已归档,默认停在「全部」:
  进知识库先看"我这儿都有些什么",待核对是待办,不该当门面。
- 正文编辑器不再是写死的 240px:新增 useEditorHeight(reserve),
  按 window.innerHeight 减掉标题/分类/标签/附件/底部按钮算高度
  (新建留 420、编辑留 340,最低 360、最高 960,窗口 resize 时重算),
  新建面板与详情编辑两处共用,长文一屏能写完一段。
- 截图脚本 shots-knowledge-view.mjs 支持 EDIT=1 出编辑态图、ALL=1 留在默认 tab;
  新增 2.Design/screens/knowledge-tab-all.png、knowledge-edit-tall.png。
- 验证:tsc --noEmit 通过、vite build ✓、e2e knowledge.mjs 9 项与
  knowledge-notebook.mjs 17 项全绿(含"侧栏分类按树排""已发布也有编辑")。
This commit is contained in:
Steven
2026-10-31 02:25:25 +08:00
parent b29286778f
commit 50227c2114
5 changed files with 42 additions and 5 deletions
+12 -2
View File
@@ -72,8 +72,10 @@ await page.addInitScript(
);
await page.goto(`${WEB}/w/${ws.id}/knowledge`, { waitUntil: "networkidle" });
await page.getByRole("heading", { name: "知识" }).waitFor({ timeout: 20_000 });
// 导入的备忘都是发布过的,切到「已发布」才看得到
await page.getByRole("button", { name: "已发布", exact: true }).first().click();
// 导入的备忘都是发布过的,切到「已发布」才看得到;ALL=1 时留在默认的「全部」
if (!process.env.ALL) {
await page.getByRole("button", { name: "已发布", exact: true }).first().click();
}
if (process.env.TITLE) {
// 挑一条带标题/列表的,截图里才看得出 Markdown 真的渲染了
const target = page.locator("li").filter({ hasText: process.env.TITLE }).first();
@@ -90,5 +92,13 @@ await page.locator(".prose-dadao").first().waitFor({ timeout: 20_000 });
await page.waitForTimeout(600);
await page.screenshot({ path: "e2e/artifacts/memo-read.png" });
if (process.env.EDIT) {
// 编辑态:正文编辑器要占满剩下的高度,不能只露几行
await page.getByRole("button", { name: "编辑", exact: true }).last().click();
await page.locator(".vditor-ir [contenteditable]").first().waitFor({ timeout: 20_000 });
await page.waitForTimeout(800);
await page.screenshot({ path: "e2e/artifacts/memo-edit.png" });
}
await browser.close();
console.log("OK");