From 6d6adc968c83a0558117d88f03b9da35ee5fa370 Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Tue, 12 May 2026 16:34:32 -0400 Subject: [PATCH] fix: wire citation handler to v2 importer The v2 importer was missing a handler for sd:citation elements. The field preprocessor converts CITATION field codes to sd:citation XML, and the v3 translator exists, but nothing bridged them to ProseMirror nodes. This follows the same pattern as bibliographyImporter.js. Fixes SD-3120 Co-Authored-By: Claude Opus 4.5 --- .../core/super-converter/v2/importer/citationImporter.js | 7 +++++++ .../v1/core/super-converter/v2/importer/docxImporter.js | 2 ++ 2 files changed, 9 insertions(+) create mode 100644 packages/super-editor/src/editors/v1/core/super-converter/v2/importer/citationImporter.js diff --git a/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/citationImporter.js b/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/citationImporter.js new file mode 100644 index 0000000000..5ba1fb6dc5 --- /dev/null +++ b/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/citationImporter.js @@ -0,0 +1,7 @@ +import { generateV2HandlerEntity } from '@core/super-converter/v3/handlers/utils'; +import { translator as citationTranslator } from '../../v3/handlers/sd/citation/citation-translator.js'; + +/** + * @type {import("./docxImporter").NodeHandlerEntry} + */ +export const citationHandlerEntity = generateV2HandlerEntity('citationHandler', citationTranslator); diff --git a/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/docxImporter.js b/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/docxImporter.js index 8de6cd9b36..f9bc4e86e1 100644 --- a/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/docxImporter.js +++ b/packages/super-editor/src/editors/v1/core/super-converter/v2/importer/docxImporter.js @@ -31,6 +31,7 @@ import { tableNodeHandlerEntity } from './tableImporter.js'; import { tableOfContentsHandlerEntity } from './tableOfContentsImporter.js'; import { indexHandlerEntity, indexEntryHandlerEntity } from './indexImporter.js'; import { bibliographyHandlerEntity } from './bibliographyImporter.js'; +import { citationHandlerEntity } from './citationImporter.js'; import { preProcessNodesForFldChar } from '../../field-references'; import { preProcessPageFieldsOnly } from '../../field-references/preProcessPageFieldsOnly.js'; import { ensureNumberingCache } from './numberingCache.js'; @@ -249,6 +250,7 @@ export const defaultNodeListHandler = () => { tableOfContentsHandlerEntity, indexHandlerEntity, bibliographyHandlerEntity, + citationHandlerEntity, indexEntryHandlerEntity, autoPageHandlerEntity, autoTotalPageCountEntity,