feat(demo): add nested SDT lock controls to contract-templates#3560
feat(demo): add nested SDT lock controls to contract-templates#3560mattConnHarbour wants to merge 1 commit into
Conversation
- Add Field Lock Controls section showing nested inline SDTs within clauses - Use contentControls.getParent() API to associate inline SDTs with parent clauses - Add individual lock/unlock toggles per field with visual state (blue filled = locked) - Add "Lock All" / "Unlock All" button for bulk operations - Use contentControls.setLockMode() API to toggle lock states - Add collapsible Fields section with toggle arrow - Add SVG lock/unlock icons from Font Awesome - Style lock buttons with blue border, inverted colors when locked Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b72aecb978
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const newLock: LockMode = child.lockMode === 'unlocked' ? 'contentLocked' : 'unlocked'; | ||
|
|
||
| assertMutation( | ||
| doc.contentControls.setLockMode({ target: child.target, lockMode: newLock }), |
There was a problem hiding this comment.
Handle edits after locking nested fields
When a user locks one of the nested smart fields exposed by this new control and then edits the same field from the left-hand field panel, applyField() still calls contentControls.text.setValue on every occurrence with that tag. The document API rejects text.setValue for contentLocked controls, so the debounced input handler aborts at the locked occurrence with an unhandled LOCK_VIOLATION and any remaining occurrences are not updated. This new lock path should either skip/handle locked occurrences or disable the corresponding field edit while locked.
Useful? React with 👍 / 👎.
Summary
contentControls.setLockMode()APIcontentControls.getParent()to associate inline SDTs (smart fields) with their parent clause SDTsPreview: https://matt-sd-3306-demo-lock-contr.superdoc-templates.pages.dev