From 6d6adc968c83a0558117d88f03b9da35ee5fa370 Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Tue, 12 May 2026 16:34:32 -0400 Subject: [PATCH 1/3] 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, From a8a4f504a1a300353cbf549ccd78e3f8d95d527d Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Thu, 14 May 2026 18:27:26 -0400 Subject: [PATCH 2/3] fix: add citation to ATOMIC_INLINE_TYPES Citation nodes have `atom: true` in their schema, so they must be included in ATOMIC_INLINE_TYPES for buildPositionMap() to correctly calculate positions during hit testing. Co-Authored-By: Claude Opus 4.5 --- packages/layout-engine/pm-adapter/src/constants.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/layout-engine/pm-adapter/src/constants.ts b/packages/layout-engine/pm-adapter/src/constants.ts index 91e46f4f01..2a78cf67cd 100644 --- a/packages/layout-engine/pm-adapter/src/constants.ts +++ b/packages/layout-engine/pm-adapter/src/constants.ts @@ -111,6 +111,7 @@ export const ATOMIC_INLINE_TYPES = new Set([ 'bookmarkEnd', 'fieldAnnotation', 'documentStatField', + 'citation', ]); /** From b54515f6e5e97204ef4403cc3af699ecbf0ac98d Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Thu, 14 May 2026 19:44:25 -0400 Subject: [PATCH 3/3] Revert "fix: add citation to ATOMIC_INLINE_TYPES" This reverts commit a8a4f504a1a300353cbf549ccd78e3f8d95d527d. --- packages/layout-engine/pm-adapter/src/constants.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/layout-engine/pm-adapter/src/constants.ts b/packages/layout-engine/pm-adapter/src/constants.ts index 2a78cf67cd..91e46f4f01 100644 --- a/packages/layout-engine/pm-adapter/src/constants.ts +++ b/packages/layout-engine/pm-adapter/src/constants.ts @@ -111,7 +111,6 @@ export const ATOMIC_INLINE_TYPES = new Set([ 'bookmarkEnd', 'fieldAnnotation', 'documentStatField', - 'citation', ]); /**