What happened?
Description:
When a run is wrapped in two or more nested HYPERLINK field codes (fldChar), all the text inside the nesting disappears on import. A single (non-nested) HYPERLINK field works fine; text before/after the fields renders fine.
Repro: Open the attached superdoc-nested-hyperlink-repro.docx. Paragraphs [3] and [4] lose their middle text; [1] and [2] are fine. WPS/Word render all of it correctly, so the file is valid OOXML.
Root cause: preProcessNodesForFldChar correctly wraps each HYPERLINK field in a <w:hyperlink>, so nested fields produce nested <w:hyperlink> elements. But the hyperlink encoder at packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/hyperlink/hyperlink-translator.js:61 keeps only direct w:r children (plus sd:pageReference/sd:autoPageNumber/sd:totalPageNumber):
const contentNodes = node.elements.filter((el) => el.name === 'w:r' || referenceNodeTypes.includes(el.name));
A nested <w:hyperlink> child is not in that set, so it (and everything inside it) is filtered out and never recursed into.
Suggested fix: flatten nested <w:hyperlink> — recurse to collect descendant w:r runs (SuperDoc's link is a mark, which can't nest anyway), or at minimum recurse into nested w:hyperlink children instead of dropping them.
superdoc-nested-hyperlink-repro.docx
Steps to reproduce
No response
SuperDoc version
1.43.0
Browser
Chrome
Additional context
No response
What happened?
Description:
When a run is wrapped in two or more nested HYPERLINK field codes (fldChar), all the text inside the nesting disappears on import. A single (non-nested) HYPERLINK field works fine; text before/after the fields renders fine.
Repro: Open the attached superdoc-nested-hyperlink-repro.docx. Paragraphs [3] and [4] lose their middle text; [1] and [2] are fine. WPS/Word render all of it correctly, so the file is valid OOXML.
Root cause: preProcessNodesForFldChar correctly wraps each HYPERLINK field in a <w:hyperlink>, so nested fields produce nested <w:hyperlink> elements. But the hyperlink encoder at packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/hyperlink/hyperlink-translator.js:61 keeps only direct w:r children (plus sd:pageReference/sd:autoPageNumber/sd:totalPageNumber):
const contentNodes = node.elements.filter((el) => el.name === 'w:r' || referenceNodeTypes.includes(el.name));
A nested <w:hyperlink> child is not in that set, so it (and everything inside it) is filtered out and never recursed into.
Suggested fix: flatten nested <w:hyperlink> — recurse to collect descendant w:r runs (SuperDoc's link is a mark, which can't nest anyway), or at minimum recurse into nested w:hyperlink children instead of dropping them.
superdoc-nested-hyperlink-repro.docx
Steps to reproduce
No response
SuperDoc version
1.43.0
Browser
Chrome
Additional context
No response