Merge main into stable - #3868
Conversation
…#3861) Keeps tables in documents whose `word/styles.xml` carries empty property containers, such as a self-closing `<w:rPr/>` on Table Grid. Word opens these files; SuperDoc was dropping the tables. Issue #3861 reports LibreOffice and some Word templates as the source. xml-js omits the `elements` key rather than emitting an empty one, so `<w:rPr/>`, `<w:rPr />` and `<w:rPr></w:rPr>` all arrive with no children, and the style reader assumed that key was there. The importer catches per node, so the throw was swallowed and only the table vanished, which is why an affected document looked blank rather than raising an error. - Reading through shared accessors closes five unguarded spots, not just the reported `w:rPr`. A `w:basedOn` pointing at a childless style throws first, before execution reaches the `w:rPr`, and with an identical message, so fixing only the reported line could look like no fix at all. - Conditional formatting entries with no `w:type` are skipped rather than keyed under `undefined`. ECMA-376 marks that attribute required. - Empty `w:tblPr`, `w:tcPr` and `w:trPr` were already safe. The issue lists them as broken, so tests record that they are not. - Fixtures parse XML strings deliberately. Hand-authored nodes using `elements: []` do not reproduce the parser shape and pass against this bug. Byte-identical across v1.43.2, v1.44.2, v1.45.2 and main. Fixes #3861 Co-authored-by: Caio Pizzol <caio@harbourshare.com> Source-PR: #3864 Closes #3864 Ported-From-Source-Repo: superdoc/orbit Ported-From-Source-Commit: 0f2d0c8330880789de1df54e7e9345eacd395ccd Ported-Public-Prefix: superdoc/public
…able (#3861) Stops one malformed `w:style` from discarding an entire imported document. Same root cause as #3861, much worse outcome, so it is split out for separate review. The style catalogue is built outside the importer per-node recovery boundary. A throw there aborts `createDocumentJson`, `getSchema` returns null, and `createDocument` falls back to an empty document, losing the whole body instead of one node. The `exception` event does fire and hosts can subscribe via `onException`, so it is not strictly silent, but the default is a blank editable page with no error state. - Scope: the fragment in #3861 does not reach this path. It needs an empty `w:outlineLvl`, an empty `w:tab`, a repeated `w:styleId` whose second record is empty, or a `w:style` with no attributes. Whether the reporting customer hit this is unknown without their file. - Guarding the crash was not enough. An outline level with a missing or non-numeric `w:val` still parsed to NaN, and a tab stop missing `w:val` or `w:pos` was still emitted half-formed. Both attributes are required in ECMA-376, so both records are now dropped, and the tests assert parsed values rather than only that import survived. - Style records with no `w:styleId` are skipped, since nothing can reference them, and the latent-style loop that collected into an unread list is gone. Not included: the `getSchema` fallback of returning null and mounting an empty document. Turning a parse failure into a blank page is arguably wrong, but it changes an initialization contract and deserves its own decision. Co-authored-by: Caio Pizzol <caio@harbourshare.com> Source-PR: #3865 Closes #3865 Ported-From-Source-Repo: superdoc/orbit Ported-From-Source-Commit: 3e95f6364d02575d3ea78019d3fa2a930617dcc4 Ported-Public-Prefix: superdoc/public
|
I wasn't able to get the ecma-spec MCP tools authorized in this session (every call returned "haven't granted it yet"), so I verified the spec claims against my own knowledge of the ECMA-376 XSDs rather than the live tools. Flagging that caveat up front. Here's the review: Status: PASS This PR is a defensive-hardening refactor: it routes all
One pre-existing item, not introduced by this PR but carried through the refactor: Net: no non-existent attributes/elements added, no missing-required regressions, and the new guards align with the required-attribute definitions on CT_TabStop, CT_DecimalNumber, and CT_TblStylePr. |
|
🎉 This PR is included in superdoc-cli v0.23.1 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.22.1 |
|
🎉 This PR is included in @superdoc-dev/mcp v0.18.1 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.46.1 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.17.1 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.18.1 |
Summary
merge/main-into-stable-2026-08-05fromstablemaininto the candidate branchstableAuto-created by promote-stable workflow.