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:
1 parent
f5c359476b
commit
3a37269f3f
44 files changed
+2261
-1072
No files matched your search
@@ -3,7 +3,7 @@ import { useEffect, useState } from "react";
|
||||
import { MessageBubble } from "@/components/MessageBubble";
|
||||
import { AppearanceSettingsView } from "@/components/settings/overview/AppearanceSettingsView";
|
||||
import { ThreadComposer } from "@/components/thread/ThreadComposer";
|
||||
import { DiffSyntaxHighlight } from "@/components/thread/activity/DiffSyntaxHighlight";
|
||||
import { FileEditGroup } from "@/components/thread/activity/FileEditRow";
|
||||
import { ThemeProvider, useTheme } from "@/hooks/useTheme";
|
||||
import { useReadingTypography } from "@/hooks/useReadingTypography";
|
||||
import { readLocalPreferences, writeLocalPreferences } from "@/lib/local-preferences";
|
||||
@@ -96,10 +96,10 @@ export function TypographyFixture() {
|
||||
</div>
|
||||
<section className="mx-auto max-w-[var(--content-column-width)] space-y-6 px-4 pb-8" aria-label="Reading preview">
|
||||
{[...previewMessages, ...sent].map((message) => <MessageBubble key={message.id} message={message} />)}
|
||||
<div className="overflow-x-auto"><DiffSyntaxHighlight language="typescript" lines={[
|
||||
{ kind: "delete", content: "const size = 16;", old_lineno: 1, new_lineno: null },
|
||||
{ kind: "add", content: "const size = preferences.readingTextSize;", old_lineno: null, new_lineno: 1 },
|
||||
]} /></div>
|
||||
<FileEditGroup displayMode="diff" edits={[{
|
||||
key: "typography", path: "size.ts", added: 1, deleted: 1, approximate: false, binary: false, status: "done", pending: false,
|
||||
diff: { format: "unified", text: "--- a/size.ts\n+++ b/size.ts\n@@ -1 +1 @@\n-const size = 16;\n+const size = preferences.readingTextSize;\n" },
|
||||
}]} />
|
||||
<ThreadComposer compactWhenIdle sessions={[session]} modelLabel="Fixture" persistDraft={false} onSend={(text) => {
|
||||
setSent((current) => [...current, { id: `sent-${current.length}`, role: "user", content: text, createdAt: 3 + current.length }]);
|
||||
}} />
|
||||
|
||||
Reference in new issue
Block a user