Skip to content

docs(structured-content): add lock mode documentation#2077

Merged
harbournick merged 16 commits intomainfrom
tadeu/docs-sdt-lock-modes
Feb 17, 2026
Merged

docs(structured-content): add lock mode documentation#2077
harbournick merged 16 commits intomainfrom
tadeu/docs-sdt-lock-modes

Conversation

@tupizz
Copy link
Copy Markdown
Contributor

@tupizz tupizz commented Feb 17, 2026

Summary

Changes

apps/docs/extensions/structured-content.mdx

  • Added lockMode attribute (StructuredContentLockMode, default 'unlocked')
  • Added Lock modes section with table, code examples, and enforcement explanation
  • Added examples to insertStructuredContentInline, insertStructuredContentBlock, and updateStructuredContentById
  • Added StructuredContentLockMode type definition
  • Updated type descriptions to list supported attrs

apps/docs/snippets/extensions/structured-content.mdx

  • Added "Protected fields" use case
  • Added interactive demo buttons: "Insert locked field", "Lock inline field", "Unlock inline field"
  • Updated quick start code with lock mode examples

Test plan

  • docs-check-imports passes (all imports valid)
  • docs-test-examples passes (282 examples, including new lock mode examples)
  • All code examples follow CodeGroup pattern (Usage + Full Example)

Document the w:lock support for structured content nodes:
- Add lockMode attribute and lock modes section to extension docs
- Add StructuredContentLockMode type definition
- Add code examples for inserting and updating lock modes
- Update interactive demo with lock/unlock buttons
- Update template builder docs with lockMode in field definitions
Copilot AI review requested due to automatic review settings February 17, 2026 11:34
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Template builder does not support lockMode in FieldDefinition or
TemplateField types yet. Remove premature documentation.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR documents the w:lock support for structured content nodes that was implemented in PR #1939. The documentation covers lock modes, their behavior, code examples, and integration with the template builder component. The changes follow established documentation patterns with CodeGroup examples and maintain consistency with ECMA-376 standards.

Changes:

  • Added comprehensive lock mode documentation with reference tables, code examples, and enforcement explanations to the Structured Content extension
  • Updated interactive demo and quick start examples in snippets with lock/unlock operations
  • Extended template builder configuration and API reference with lockMode field definitions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/docs/extensions/structured-content.mdx Added lockMode attribute, lock modes section with table and code examples, updated command documentation with lock mode examples, added StructuredContentLockMode type definition
apps/docs/snippets/extensions/structured-content.mdx Added "Protected fields" use case, added interactive demo buttons for locked fields and lock/unlock operations, updated quick start code with lock mode examples
apps/docs/solutions/template-builder/configuration.mdx Added lockMode examples to field definitions, added lock modes subsection with reference table and explanation
apps/docs/solutions/template-builder/api-reference.mdx Added lockMode property to FieldDefinition and TemplateField type definitions with reference link

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lockMode is not yet available in the published editor version.
Restore original block field and update buttons that work today.
Add buttons to lock and unlock both inline and block fields using
updateStructuredContentById with lockMode attribute.
Replace placeholder quote with a realistic service agreement template
that demonstrates practical use of inline and block fields.
Insert inline and block fields with sdtLocked by default. Add
sdtContentLocked lock buttons for both field types and a single
unlock-all button.
Use onReady callback to auto-insert inline and block sdtLocked fields
into the example document on load, replacing placeholder text with
real structured content fields. Reorganize buttons into logical groups:
update actions, lock mode actions, and delete.
lockMode is not available in the published version yet (PR #1939).
Remove it from onReady field insertions so the demo works with the
current superdoc@latest on unpkg.
Lock mode buttons depend on PR #1939 which isn't published yet.
Remove them until lockMode is available in superdoc@latest.
lockMode is available in superdoc@latest (v1.13.1). Restore
sdtLocked on onReady field insertions and lock/unlock buttons.
getStructuredContentTags returns {node, pos} objects — attrs are on
node.attrs, not directly on the object.
…action

updateStructuredContentById uses replaceWith which creates a ReplaceStep
that the lock plugin blocks. Use tr.setNodeAttribute instead, which
creates an AttrStep that the lock plugin explicitly skips.
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge after addressing comments

Comment thread apps/docs/extensions/structured-content.mdx
Comment thread apps/docs/extensions/structured-content.mdx
Comment thread apps/docs/extensions/structured-content.mdx
Comment thread apps/docs/extensions/structured-content.mdx Outdated
Comment thread apps/docs/snippets/extensions/structured-content.mdx Outdated
Comment thread apps/docs/extensions/structured-content.mdx
Comment thread apps/docs/snippets/extensions/structured-content.mdx
- Differentiate lock mode insert example from command section example
  (use sdtContentLocked/Account ID instead of duplicate sdtLocked/Customer Name)
- Wrap enforcement details in Expandable for scannability
- Add missing `group` to block insert attrs type
- Replace raw tr.setNodeAttribute with updateStructuredContentById in demo
Copy link
Copy Markdown
Collaborator

@harbournick harbournick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@harbournick harbournick merged commit f67e225 into main Feb 17, 2026
5 checks passed
@harbournick harbournick deleted the tadeu/docs-sdt-lock-modes branch February 17, 2026 23:15
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.

5 participants