You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Word sometimes emits DrawingML tags with arbitrary prefixes (e.g. ns6:). Our importer only looked for literal a:graphic/a:graphicData, so it dropped the whole drawing, emitted a passthroughBlock inside the run, and calculateInlineRunPropertiesPlugin crashed with RangeError: Invalid content for node type run.
Proposed solution
Normalize DrawingML lookups by local name in handleImageNode (and helpers) so graphic/graphicData, blips, transforms, etc. are found regardless of prefix; do the same in vector-shape-helpers.
All elements and attributes check out against the spec. The PR is a namespace-prefix normalization refactor — instead of hard-coding a: prefixes (e.g. el.name === 'a:graphic'), it now uses local-name matching utilities, which is more robust when parsers emit alternate prefixes like ns6:.
Status: PASS
Every DrawingML element and attribute accessed in this diff is valid per ECMA-376:
a:grayscl — empty element, no attributes, correct (§20.1.8.34)
a:linang — correct (§20.1.8.41)
a:gspos — correct (§20.1.8.36)
a:path (in gradFill) path attribute — correct (§20.1.8.46)
The findChildByLocalName / hasLocalName utilities are semantically equivalent to the original exact-match lookups for well-formed documents, and handle the alternate-prefix case correctly. The test covering ns6: prefixed nodes is a good addition.
One pre-existing note unrelated to this PR: in extractLineEnds, width and length in the return { type, width, length } are never assigned from the parsed attributes (they'll be undefined). That's not introduced here, but worth a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Word sometimes emits DrawingML tags with arbitrary prefixes (e.g.
ns6:). Our importer only looked for literala:graphic/a:graphicData, so it dropped the whole drawing, emitted apassthroughBlockinside the run, andcalculateInlineRunPropertiesPlugincrashed withRangeError: Invalid content for node type run.Proposed solution
Normalize DrawingML lookups by local name in
handleImageNode(and helpers) sographic/graphicData, blips, transforms, etc. are found regardless of prefix; do the same invector-shape-helpers.