diff --git a/frontend/src/components/shared/editor-inline-scan.ts b/frontend/src/components/shared/editor-inline-scan.ts index 0ad7765f..f7f71aaa 100644 --- a/frontend/src/components/shared/editor-inline-scan.ts +++ b/frontend/src/components/shared/editor-inline-scan.ts @@ -18,7 +18,7 @@ export const collectInlineMatches = (doc: PMNode, regex: RegExp): InlineMatch[] doc.descendants((node, pos) => { if (!node.isTextblock) { - return; // a container — recurse into it to reach its textblocks + return; } let text = ''; @@ -46,7 +46,7 @@ export const collectInlineMatches = (doc: PMNode, regex: RegExp): InlineMatch[] } } - return false; // inline content handled — don't recurse into the text nodes + return false; }); return matches; diff --git a/frontend/src/components/shared/editor-markdown.ts b/frontend/src/components/shared/editor-markdown.ts index 25f2c822..b00978e0 100644 --- a/frontend/src/components/shared/editor-markdown.ts +++ b/frontend/src/components/shared/editor-markdown.ts @@ -77,8 +77,6 @@ export const MarkdownTable = Table.extend({ }, }); -// `new Marked()` is a Marked instance, but the `marked` option is typed as the default singleton (which -// carries extra statics like getDefaults); the cast bridges that structural gap. export const createMarkdownLayer = () => [ Markdown.configure({ marked: createFaithfulMarked() as unknown as typeof import('marked').marked }), FaithfulMarkdownText, diff --git a/frontend/src/components/shared/markdown-editor-corpus.test.ts b/frontend/src/components/shared/markdown-editor-corpus.test.ts index af7989a8..d8b76825 100644 --- a/frontend/src/components/shared/markdown-editor-corpus.test.ts +++ b/frontend/src/components/shared/markdown-editor-corpus.test.ts @@ -15,9 +15,6 @@ beforeAll(() => { ({ item: () => null, length: 0, [Symbol.iterator]: [][Symbol.iterator] }) as unknown as DOMRectList; }); -// Node-fs corpus test: reads the real backend prompt templates (XML-tag-heavy Go templates) and asserts -// the @tiptap/markdown round-trip preserves their CONTENT on EVERY one. Excluded from the app `tsc` build -// (uses node APIs); validated at runtime by vitest. const roundTrip = (content: string): string => { const editor = new Editor({ content, contentType: 'markdown', extensions: createMarkdownExtensions() }); const out = editor.getMarkdown(); @@ -39,16 +36,12 @@ describe('corpus — every real prompt .tmpl survives the round-trip with no con const save1 = roundTrip(src); const save2 = roundTrip(save1); - // tags stay literal — no HTML-entity escaping introduced. expect(save1).not.toContain('<'); expect(save1).not.toContain('>'); - // every {{ }} action survives (set + order). expect(variables(save1)).toEqual(variables(src)); - // no source word is dropped (cosmetic whitespace reformatting aside). const after = new Set(words(save2)); const lost = [...new Set(words(src))].filter((w) => !after.has(w)); expect(lost).toEqual([]); - // converges — the canonical form is stable on resave. expect(roundTrip(save2)).toBe(save2); }); } diff --git a/frontend/src/components/shared/markdown-editor-extensions.test.ts b/frontend/src/components/shared/markdown-editor-extensions.test.ts index 9983097e..f9f2f019 100644 --- a/frontend/src/components/shared/markdown-editor-extensions.test.ts +++ b/frontend/src/components/shared/markdown-editor-extensions.test.ts @@ -100,7 +100,6 @@ describe('MarkdownTable — cell pipes escaped + alignment preserved, idempotent it('preserves per-column alignment (left :--- / center :---: / right ---:)', () => { const save1 = roundTrip('| L | C | R |\n| :-- | :-: | --: |\n| a | b | c |'); - // renderTableToMarkdown emits the alignment colons (dash count padded to column width, min 3). expect(save1).toContain('| :--- | :---: | ---: |'); expect(roundTrip(save1)).toBe(save1); }); @@ -120,7 +119,6 @@ describe('nesting & sequencing — content preserved and converges (≤2 saves)' const save1 = roundTrip(src); const save2 = roundTrip(save1); - // converges (canonicalizes once, then stable) and no word is dropped. expect(save2).toBe(save1); sameWords(src, save2); }); diff --git a/frontend/src/components/shared/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor.tsx index d2f129d7..6e02523c 100644 --- a/frontend/src/components/shared/markdown-editor.tsx +++ b/frontend/src/components/shared/markdown-editor.tsx @@ -190,8 +190,6 @@ function MarkdownEditor({ [editor], ); - // Keep external value in sync (e.g. on form reset). Avoid resetting if - // the editor already reflects the same markdown to keep cursor stable. useEffect(() => { if (!editor) { return; diff --git a/frontend/src/features/knowledges/knowledge-form.tsx b/frontend/src/features/knowledges/knowledge-form.tsx index 3f28f718..d019b7cb 100644 --- a/frontend/src/features/knowledges/knowledge-form.tsx +++ b/frontend/src/features/knowledges/knowledge-form.tsx @@ -237,11 +237,8 @@ export function KnowledgeForm({ initialValues, isNew, knowledge, onSubmit }: Kno // `isDirty`/`canSubmit` at submit time. const result = await onSubmit(values, form.formState.dirtyFields as DirtyFlags); - // Prefer the server's view of the document — backend may have - // trimmed/normalized fields, attached derived data, or filled - // optional fields. Falling back to the local `values` keeps - // the form stable when the mutation hook can't return the - // saved fragment for some reason. + // After save, show the server's canonical (trimmed/normalized) document; fall back to the + // submitted values if the mutation hook didn't return the saved fragment. const resetValues = result.document ? documentToFormValues(result.document) : values; // Reset BEFORE the caller navigates so `isDirty` is false by the diff --git a/frontend/src/pages/settings/settings-providers.tsx b/frontend/src/pages/settings/settings-providers.tsx index e4195b70..e08d8ee2 100644 --- a/frontend/src/pages/settings/settings-providers.tsx +++ b/frontend/src/pages/settings/settings-providers.tsx @@ -68,14 +68,6 @@ export function SettingsProvidersHeader() {

Manage language model providers

- {/* - * "Create Provider" is a dropdown trigger, not a submit-style action — it - * opens a menu listing provider types (OpenAI, Anthropic, Custom, …). The - * `` icon plus Radix's `aria-haspopup="menu"` already signal - * "menu opens" to sighted and AT users; the explicit aria-label adds the - * intent ("create provider") so screen readers don't just announce - * "Create Provider, menu" but "Create provider, choose type, menu". - */}