SD-2279 - fix: floating textbox not rendering#2732
Conversation
|
All elements and attributes check out against the spec. The PR is a namespace-prefix normalization refactor — instead of hard-coding Status: PASS Every DrawingML element and attribute accessed in this diff is valid per ECMA-376:
The One pre-existing note unrelated to this PR: in |
caio-pizzol
left a comment
There was a problem hiding this comment.
hey @chittolinag! good call on this :)
one out-of-diff thing worth a follow-up: merge-drawing-children.js:105-106 still hardcodes a:graphic. on export, a doc with the ns6: prefix won't get the same treatment. not a blocker here.
lgtm - feel free to merge after addressing the inline notes.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Migrates two remaining hardcoded namespace prefix lookups in the DrawingML import path so docs that re-prefix the DrawingML namespace (e.g. ns6: instead of a:) get consistent treatment alongside the rest of the PR. - encode-image-node-helpers.js: `adec:decorative`/`a16:decorative` in wp:docPr extLst now matches by local name `decorative`. - merge-drawing-children.js: `a:graphic`/`a:graphicData` in the zero-id repair path now use findChildByLocalName.
Adds regression tests for the namespace-prefix-agnostic lookups introduced in the previous commit: - encode-image-node-helpers: covers `adec:decorative`, `a16:decorative`, re-aliased `ns7:decorative`, val=0, and missing-decorative cases. - merge-drawing-children: covers the zero-id repair path when the graphic subtree uses `ns6:graphic` / `ns6:graphicData`. Both new "re-prefixed" tests fail against the pre-fix implementation and pass after, locking in the local-name matching as the contract.
Adds a 'namespace prefix tolerance' describe block to lock in the
local-name matching introduced in this PR for vector-shape-helpers.js
(34 callsites converted from `el.name === 'a:foo'` to findChild /
hasLocalName / filterChildren / getLocalName).
Covers the public surface that depends on those helpers:
- extractStrokeWidth (a:ln)
- extractStrokeColor (a:ln/a:noFill/a:solidFill/a:srgbClr/a:schemeClr)
- extractFillColor (a:solidFill/a:gradFill stops/lin angle)
- extractLineEnds (a:ln/a:headEnd/a:tailEnd)
- extractCustomGeometry (a:custGeom/a:pathLst/a:path with
a:moveTo/a:lnTo/a:close, plus a:pt children)
6 of the 7 new tests fail against the pre-fix implementation and
pass after, locking in the local-name matching as the contract.
|
hey @chittolinag! quick follow-up. i pushed the two fixes, added tests so we don't lose this, and uploaded a sample doc so layout and visual tests cover it. lgtm. |
|
🎉 This PR is included in superdoc v1.30.0-next.8 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.8 |
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.4 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.49 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0-next.51 |
|
🎉 This PR is included in superdoc v1.30.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.8.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.8.0 |
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0 |
|
🎉 This PR is included in @superdoc-dev/react v1.3.0 The release is available on GitHub release |
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.