docs(structured-content): add lock mode documentation#2077
docs(structured-content): add lock mode documentation#2077harbournick merged 16 commits intomainfrom
Conversation
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
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Template builder does not support lockMode in FieldDefinition or TemplateField types yet. Remove premature documentation.
There was a problem hiding this comment.
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.
caio-pizzol
left a comment
There was a problem hiding this comment.
Feel free to merge after addressing comments
- 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
Summary
w:locksupport for structured content nodes added in feat(super-editor): add w:lock support for StructuredContent nodes (SD-1616) #1939lockModeattribute, lock modes reference table, and code examples to the extension docsChanges
apps/docs/extensions/structured-content.mdxlockModeattribute (StructuredContentLockMode, default'unlocked')insertStructuredContentInline,insertStructuredContentBlock, andupdateStructuredContentByIdStructuredContentLockModetype definitionapps/docs/snippets/extensions/structured-content.mdxTest plan
docs-check-importspasses (all imports valid)docs-test-examplespasses (282 examples, including new lock mode examples)