Annotate Wikipedia articles with the same keys as nodes
An article's text is drawn from its sanitised HTML as selectable text (articleText.ts): paragraphs, list items and quotes with their inline elements; a formula is one unit; tables and preformatted blocks are shown but carry no offsets. The selection ladder, Tab, Enter, e d y x c :, D and the rest go through the same store paths as on a node; a note on article words is a note (Enter steps into it; c, f, u, the editor and history work on it as on any other) and shows wherever the article is opened, in the library's own note style. Detached annotations are listed at the top of their section with a link to the old revision. Keys that only make sense on a node say why in the status line. Tab on a link now selects its words, so Esc widens before h leaves, as in a node. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
f63fc10dc0
commit
2c1ee048a4
18 files changed
+1134
-126
No files matched your search
+3
-3
@@ -56,7 +56,7 @@ test.afterEach(({ page }) => settle(page));
|
||||
test("the library is the first page: its documents are its sections, and opening one needs no closing step", async ({ page }) => {
|
||||
await open(page, "/");
|
||||
await expect(page.locator(".top h1")).toHaveText("Library");
|
||||
const docs = await state(page, (s) => s.snap.nodes[s.snap.root].children.length);
|
||||
const docs = await state(page, (s) => s.snap.nodes[s.snap.root].children.filter((c: string) => !s.snap.nodes[c].articles).length);
|
||||
await expect(page.locator("article > .outline > .node")).toHaveCount(docs);
|
||||
await expect(page.locator("article > .outline > .node.open")).toHaveCount(0);
|
||||
await keys(page, "j Enter"); // the first document's row: it opens in place of the list
|
||||
@@ -81,7 +81,7 @@ test("m opens the menu, in library order, and the title in the top bar opens it
|
||||
await expect(panel.locator(".doc.current")).toContainText("Infinispand");
|
||||
await expect(panel.locator(".doc.current")).toContainText(/open · (saved|saving…)/);
|
||||
const listed = await panel.locator(".doc .title").allTextContents();
|
||||
expect(listed).toEqual(await state(page, (s) => s.snap.nodes[s.snap.root].children.map((c: string) => s.snap.nodes[c].title)));
|
||||
expect(listed).toEqual(await state(page, (s) => s.snap.nodes[s.snap.root].children.filter((c: string) => !s.snap.nodes[c].articles).map((c: string) => s.snap.nodes[c].title)));
|
||||
await keys(page, "Escape Escape");
|
||||
await expect(panel).toHaveCount(0);
|
||||
await page.locator(".docbar .doc-title").click();
|
||||
@@ -234,7 +234,7 @@ test("create, rename and duplicate from the menu", async ({ page }) => {
|
||||
await expect(page).toHaveURL(/\/doc\/scratch-copy$/);
|
||||
// The copy sits after the original in the library, and is one commit in its history.
|
||||
expect(await state(page, (s) => s.commits()[0].message)).toBe("Duplicate “Scratch pad, renamed” as “Scratch copy”");
|
||||
const order = await state(page, (s) => s.snap.nodes[s.snap.root].children.map((c: string) => s.snap.nodes[c].slug));
|
||||
const order = await state(page, (s) => s.snap.nodes[s.snap.root].children.filter((c: string) => !s.snap.nodes[c].articles).map((c: string) => s.snap.nodes[c].slug));
|
||||
expect(order.indexOf("scratch-copy")).toBe(order.indexOf("scratch-pad") + 1);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user