refactor(webui): unify code and diff highlighting (#6412)

* refactor(webui): unify code and diff highlighting

Replace Prism with shared Highlights tokens and Pierre read-only diffs, retaining rare grammars through lazy Shiki and preserving source, copy, preview and diff controls.

Restore single-session Composer ownership inside the conversation column while retaining the shared multi-pane footer. Keep the measured large-diff scroll regression explicit during review.

* fix(webui): contain highlighting errors and retain diff selections

Refs NAN-343

* test(webui): align pane fixtures after main rebase

* chore(webui): update highlighting dependencies

Keep grammar fallback coverage on a language that still requires Shiki, and align reading-size assertions with main.
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-06 16:41:12 +08:00
1 parent f5c359476b
commit 3a37269f3f
44 files changed
+2261 -1072

No files matched your search

+12
View File
@@ -4088,6 +4088,13 @@ describe("App layout", () => {
.toEqual(["Alpha"]);
expect(screen.queryByRole("button", { name: "Layout" }))
.not.toBeInTheDocument();
const alphaInput = screen.getByRole("textbox", { name: "Message Alpha" });
expect(screen.getByTestId("workbench-pane-websocket:chat-alpha")).toContainElement(alphaInput);
fireEvent.change(alphaInput, { target: { value: "keep this Alpha draft" } });
fireEvent.change(alphaInput.closest(".thread-composer-surface")!.querySelector('input[type="file"]')!, {
target: { files: [new File(["notes"], "alpha-notes.txt", { type: "text/plain" })] },
});
expect(within(await screen.findByTestId("composer-chip")).getByRole("button", { name: "alpha-notes.txt" })).toBeVisible();
fireEvent.click(screen.getByRole("button", { name: "Add pane" }));
expect(screen.queryByRole("dialog", { name: "Search" })).not.toBeInTheDocument();
@@ -4163,6 +4170,11 @@ describe("App layout", () => {
name: "Remove",
}));
await waitFor(() => expect(screen.getByTestId("pane-grid").children).toHaveLength(1));
fireEvent.click(within(sidebar).getByRole("button", { name: "Alpha" }));
const restoredInput = await screen.findByRole("textbox", { name: "Message Alpha" });
expect(screen.getByTestId("workbench-pane-websocket:chat-alpha")).toContainElement(restoredInput);
expect(restoredInput).toHaveValue("keep this Alpha draft");
expect(within(await screen.findByTestId("composer-chip")).getByRole("button", { name: "alpha-notes.txt" })).toBeVisible();
const researchGroup = within(sidebar).getByRole("button", {
name: "Group: Research",
}).closest("[data-sidebar-tab-group]") as HTMLElement;