diff --git a/frontend/src/components/shared/markdown-editor-extensions.test.ts b/frontend/src/components/shared/markdown-editor-extensions.test.ts index e9937bc5..515e7102 100644 --- a/frontend/src/components/shared/markdown-editor-extensions.test.ts +++ b/frontend/src/components/shared/markdown-editor-extensions.test.ts @@ -12,8 +12,6 @@ beforeAll(() => { ({ item: () => null, length: 0, [Symbol.iterator]: [][Symbol.iterator] }) as unknown as DOMRectList; }); -// Runs the EXACT production extension set (createMarkdownExtensions) through the official -// @tiptap/markdown round-trip: markdown string -> marked parse -> ProseMirror doc -> getMarkdown(). const roundTrip = (content: string): string => { const editor = new Editor({ content, contentType: 'markdown', extensions: createMarkdownExtensions() }); const out = editor.getMarkdown(); diff --git a/frontend/src/features/knowledges/knowledge-form.tsx b/frontend/src/features/knowledges/knowledge-form.tsx index dc0002a4..3f28f718 100644 --- a/frontend/src/features/knowledges/knowledge-form.tsx +++ b/frontend/src/features/knowledges/knowledge-form.tsx @@ -119,9 +119,6 @@ export const documentToFormValues = (k: KnowledgeDocumentFragmentFragment): Form question: k.question, }); -// react-hook-form's `dirtyFields` is a partial map of the same shape as -// `FormValues`, with `true` for fields the user actually changed compared to -// `defaultValues`. We project it onto the (flat) FormValues keys here. export type DirtyFlags = Partial>; // CREATE: send all required fields and only non-empty optional fields. There @@ -142,10 +139,8 @@ export const formValuesToCreateInput = (values: FormValues): CreateKnowledgeDocu // every other field is gated by `dirty`. This way: // - untouched fields stay `undefined` and the backend keeps the existing value; // - cleared fields go out as `""` so the backend wipes them; -// - subtype-related fields cleared by `setValue` on docType change are -// marked dirty by the form, so they reach the backend with the right -// "clear me" value (the backend additionally wipes mismatching subtypes -// itself, but we mirror the user-visible state explicitly). +// - subtype-related fields cleared by `setValue` on docType change are marked +// dirty by the form, so they reach the backend with the right "clear me" value. export const formValuesToUpdateInput = (values: FormValues, dirty: DirtyFlags): UpdateKnowledgeDocumentInput => { const input: UpdateKnowledgeDocumentInput = { content: values.content };