Show one view control and name the file once

Phase 5-3.

- One radio group shows Write, Source, and Read at all times, with an
  icon and a name. Narrow panes show only the icons. The arrow keys
  move the choice, and the group has one Tab stop. The current choice
  gets the selection fill and an accent bar. Hover gets only a fill.
- A Split toggle shows Read beside Write or Source. Each document pane
  keeps a split flag beside its reading flag. Read ends Split.
- Ctrl+Shift+E switches between Read and the editor. Ctrl+E still
  switches between Write and Source.
- "IDE" becomes "Source" in the Chrome type, the tab menu (a View
  submenu), the status bar, the catalog, the tests, and the docs.
- Settings, General, File name title hides the title in Write and
  Read. It is on by default.
- The breadcrumb shows only the folder of the file. The status bar
  shows the view, not the path.
- ModeSwitcher.svelte and its hover test are gone. The new test
  layout/viewModes covers the control.
- The command palette from 5-2 gets its row in docs/menu-surfaces.json.
- The user guide Format table is whole again. The 5-2 edit had put
  the Paragraph and Insert rows under the shortcut table.
- 8 new catalog rows and 10 removed rows, in French, Japanese, and
  Simplified Chinese.
- Docs: UI-049, the user guide, ui-design.md, document-tools.md,
  development.md, and the README feature list.

Tests: the new layout/viewModes, new cases in documentPanes.spec.ts
and settings.spec.ts, and the chooseView harness helper. 21 smoke
tests use the new control. Tests that read the full path from the
breadcrumb now read its tooltip.
This commit is contained in:
Knotty Wyvern
2026-10-28 19:45:08 -07:00
parent ebacdb8164
commit 9cf82503d0
64 changed files with 675 additions and 590 deletions
+21 -12
View File
@@ -37,7 +37,7 @@ await runSmoke("tabs/menus", async ({ page }) => {
await show("b.md");
assert.equal(await tab("d.md").getAttribute("aria-selected"), "true");
assert.equal(await item("Rename…").count(), 0);
assert.equal(await item("Reading view").count(), 0);
assert.equal(await item("View").count(), 0);
assert.doesNotMatch(await menu().innerText(), /Alt|Shift|Ctrl/);
await page.screenshot({ path: path.join(output, "inactive.png") });
await item("Pin").click();
@@ -55,18 +55,27 @@ await runSmoke("tabs/menus", async ({ page }) => {
assert.equal(await item("Move tab left").evaluate(node => node === document.activeElement), true);
await page.keyboard.press("ArrowLeft");
await page.keyboard.press("Escape");
// The View submenu has the same choices as the view control of the pane.
const view = async name => {
await show("d.md");
await item("View").click();
await page.getByRole(name === "Split" ? "menuitemcheckbox" : "menuitemradio", { name, exact: true }).click();
};
await show("d.md");
await item("Reading view").click();
await item("View").click();
assert.equal(await page.getByRole("menuitemradio", { name: "Write", exact: true }).getAttribute("aria-checked"), "true");
await page.keyboard.press("Escape");
await page.keyboard.press("Escape");
await view("Read");
await page.locator(".md-page").waitFor();
await show("d.md");
await item("Editing view").click();
await page.locator(".cm-editor").waitFor();
await show("d.md");
await item("Source mode").click();
await page.locator(".source-editor .cm-content").waitFor();
await show("d.md");
await item("Writing mode").click();
await page.locator(".cm-editor").waitFor();
await view("Split");
await page.locator(".body.split .md-page").waitFor();
await view("Source");
await page.locator(".body.split .source-editor .cm-content").waitFor();
await view("Split");
await page.locator(".md-page").waitFor({ state: "detached" });
await view("Write");
await page.locator(".live-writer .cm-editor").waitFor();
await show("d.md");
await item("Copy path").click();
await item("Workspace path").click();
@@ -115,6 +124,6 @@ await runSmoke("tabs/menus", async ({ page }) => {
await added.click({ button: "right" });
await menu().waitFor();
assert.equal(await item("Rename…").count(), 0);
assert.equal(await item("Reading view").count(), 0);
assert.equal(await item("View").count(), 0);
await page.keyboard.press("Escape");
}, { timeout: 15000 });
+9 -16
View File
@@ -1,6 +1,6 @@
// Each tab keeps its own scroll position in the Writing, Reading, Split, and IDE layouts.
// Each tab keeps its own scroll position in the Writing, Reading, Split, and Source layouts.
import assert from "node:assert/strict";
import { mockTauri, runSmoke, settle as settleFrames, smokeUrl } from "../_harness/index.mjs";
import { chooseView, mockTauri, runSmoke, settle as settleFrames, smokeUrl } from "../_harness/index.mjs";
await runSmoke("tabs/scroll", async ({ page }) => {
await mockTauri(page, {
@@ -57,27 +57,20 @@ await runSmoke("tabs/scroll", async ({ page }) => {
await page.getByRole('tab', { name: 'scroll-a.md', exact: true }).click();
}
// The view and layout switchers show only the current mode until hovered (src/lib/ui/ModeSwitcher.svelte:92, :153).
async function mode(group, name) {
const switcher = page.getByRole('group', { name: group, exact: true });
await switcher.hover();
await switcher.getByRole('button', { name, exact: true }).click();
}
await page.goto(smokeUrl);
await page.getByText('smoke-workspace', { exact: true }).waitFor();
await open('scroll-b.md');
await open('scroll-a.md');
await mode('Editor layout', 'Writer');
await chooseView(page, 'Write');
await roundTrip('.cm-scroller', 'Writing');
await mode('Document view', 'Read');
await chooseView(page, 'Read');
await roundTrip('.md-page', 'Reading');
await mode('Document view', 'Split');
await chooseView(page, 'Split');
await roundTrip('.md-page', 'Split preview');
await mode('Document view', 'Edit');
await mode('Editor layout', 'IDE');
await chooseView(page, 'Split');
await chooseView(page, 'Source');
await page.getByRole('tab', { name: 'scroll-b.md', exact: true }).click();
await mode('Editor layout', 'IDE');
await chooseView(page, 'Source');
await page.getByRole('tab', { name: 'scroll-a.md', exact: true }).click();
await roundTrip('.source-editor .cm-scroller', 'IDE');
await roundTrip('.source-editor .cm-scroller', 'Source');
});