Skip to content

fix(content-controls): default newly-created controls to richText, not unknown (SD-3139)#3281

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-3139-richtext-default
May 14, 2026
Merged

fix(content-controls): default newly-created controls to richText, not unknown (SD-3139)#3281
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-3139-richtext-default

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Follow-up to SD-3131 (#3275). After that PR, imported typeless w:sdtPr correctly resolves to controlType: 'richText' per ECMA-376 §17.5.2.26, but newly created controls via create.contentControl (with controlType omitted) and contentControls.wrap still defaulted to 'unknown'. Customers filtering contentControls.list() by type saw different results before vs after save/reopen — the same typeless OOXML round-tripped from 'unknown' to 'richText'.

Path In-memory After save → reimport
create.contentControl({ kind }) 'unknown' 'richText'
contentControls.wrap 'unknown' (resolveControlType fallback) 'richText'
  • createWrapper: collapse three ?? 'unknown' into a single ?? 'richText' local.
  • wrapWrapper: explicitly seed controlType, type, and a default sdtPr with <w:richText/> on the wrapper attrs (previously controlType was unset entirely, leaving resolveControlType to fall back to 'unknown').

Newly created controls now emit explicit <w:richText/> in sdtPr for unambiguous engine state and exported markup. Imported typeless Word-authored SDTs preserve their original raw sdtPr (import path unchanged).

Per the SD-3131 design, 'unknown' keeps its meaning of "unsupported or unrecognized type" — it's no longer the default for new controls.

Tests: 3 new — default-create → richText, explicit-richText-create seeds <w:richText/>, wrap → richText + seeds <w:richText/>. 42 wrappers + 1189 conformance + 1398 document-api pass. Zero new TypeScript errors.

Non-blocking follow-up: create.contentControl and setType still accept explicit controlType: 'unknown' because 'unknown' is in the shared read/write enum. That can produce stable-but-deliberately-unknown controls, which is a separate API-shape question — worth tightening mutation validation if 'unknown' should be read-only. Not blocking this PR.

Related: SD-3131.

…t unknown (SD-3139)

Follow-up to SD-3131 (#3275). After that PR, imported typeless w:sdtPr
correctly resolves to controlType: 'richText' per ECMA-376 §17.5.2.26,
but newly created controls via create.contentControl (no controlType)
and contentControls.wrap still defaulted to 'unknown'. Customers
filtering contentControls.list() by type saw different results before
vs after save/reopen — the same typeless OOXML round-tripped from
'unknown' to 'richText'.

- createWrapper: collapse three `?? 'unknown'` into a single
  `?? 'richText'` local.
- wrapWrapper: explicitly seed controlType, type, and a default
  sdtPr with <w:richText/> on the wrapper attrs (previously
  controlType was unset entirely, leaving resolveControlType to
  fall back to 'unknown').

Newly created controls now emit explicit <w:richText/> in sdtPr for
unambiguous engine state and exported markup. Imported typeless
Word-authored SDTs preserve their original raw sdtPr (import path
unchanged).

Per the SD-3131 design, 'unknown' keeps its meaning of "unsupported
or unrecognized type" — it's no longer the default for new controls.

Tests: 3 new (default-create → richText, explicit-richText-create
seeds <w:richText/>, wrap → richText + seeds <w:richText/>).
42 wrappers + 1189 conformance + 1398 document-api pass.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 14, 2026 10:18
@linear
Copy link
Copy Markdown

linear Bot commented May 14, 2026

SD-3139

@caio-pizzol caio-pizzol merged commit a9ab6f1 into main May 14, 2026
2 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-3139-richtext-default branch May 14, 2026 10:18
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.90

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.135

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.133

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in superdoc-cli v0.8.0-next.105

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in superdoc-sdk v1.8.0-next.89

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 14, 2026

🎉 This PR is included in superdoc v1.30.0-next.87

The release is available on GitHub release

msviderok pushed a commit to msviderok/superdoc that referenced this pull request May 16, 2026
…t unknown (SD-3139) (superdoc-dev#3281)

Follow-up to SD-3131 (superdoc-dev#3275). After that PR, imported typeless w:sdtPr
correctly resolves to controlType: 'richText' per ECMA-376 §17.5.2.26,
but newly created controls via create.contentControl (no controlType)
and contentControls.wrap still defaulted to 'unknown'. Customers
filtering contentControls.list() by type saw different results before
vs after save/reopen — the same typeless OOXML round-tripped from
'unknown' to 'richText'.

- createWrapper: collapse three `?? 'unknown'` into a single
  `?? 'richText'` local.
- wrapWrapper: explicitly seed controlType, type, and a default
  sdtPr with <w:richText/> on the wrapper attrs (previously
  controlType was unset entirely, leaving resolveControlType to
  fall back to 'unknown').

Newly created controls now emit explicit <w:richText/> in sdtPr for
unambiguous engine state and exported markup. Imported typeless
Word-authored SDTs preserve their original raw sdtPr (import path
unchanged).

Per the SD-3131 design, 'unknown' keeps its meaning of "unsupported
or unrecognized type" — it's no longer the default for new controls.

Tests: 3 new (default-create → richText, explicit-richText-create
seeds <w:richText/>, wrap → richText + seeds <w:richText/>).
42 wrappers + 1189 conformance + 1398 document-api pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant