Skip to content

feat(demo): add nested SDT lock controls to contract-templates#3560

Open
mattConnHarbour wants to merge 1 commit into
mainfrom
matt/SD-3306-demo-lock-controls
Open

feat(demo): add nested SDT lock controls to contract-templates#3560
mattConnHarbour wants to merge 1 commit into
mainfrom
matt/SD-3306-demo-lock-controls

Conversation

@mattConnHarbour
Copy link
Copy Markdown
Contributor

@mattConnHarbour mattConnHarbour commented May 29, 2026

Summary

  • Adds nested SDT lock controls UI to the contract-templates demo
  • Implements per-field lock/unlock toggles using contentControls.setLockMode() API
  • Uses contentControls.getParent() to associate inline SDTs (smart fields) with their parent clause SDTs
  • Adds "Lock All" / "Unlock All" button for bulk operations on fields within a clause

Preview: https://matt-sd-3306-demo-lock-contr.superdoc-templates.pages.dev

- 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>
@mattConnHarbour mattConnHarbour requested a review from a team as a code owner May 29, 2026 04:14
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 29, 2026

SD-3306

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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 }),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

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