feat(template-builder): wire lockMode through field insertion paths#2721
Merged
caio-pizzol merged 7 commits intomainfrom Apr 6, 2026
Merged
Conversation
SuperDoc core already enforces SDT lock modes (SD-1616), but Template Builder never passed lockMode to the editor commands. This adds: - LockMode type and lockMode prop on FieldDefinition / TemplateField - defaultLockMode prop on SuperDocTemplateBuilderProps - lockMode threading through insertFieldInternal, handleSelectExisting, and handleMenuSelect - lockMode read-back in getTemplateFieldsFromEditor Closes SD-1866
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d925e9d23
ℹ️ 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".
areTemplateFieldsEqual omitted lockMode, so lock-only changes were silently dropped by discoverFields. Also tightens the lockMode spread guard from truthiness to nullish check for consistency with the ?? resolution above.
Documents field locking in configuration guide and API reference.
Adds a dropdown to the default FieldMenu create form so users can set a lock mode when creating new fields. Options: No lock, Unlocked, Container locked, Content locked, Fully locked.
- deleteField no longer force-removes locked fields from state when the editor command is rejected by the lock plugin - FieldList sidebar shows a lock icon for fields with active lock modes
- Revert lock guard in deleteField — template authors can always delete fields regardless of lock mode - Replace 5-option lock dropdown with a simple "Locked" checkbox that maps to contentLocked - Full LockMode type still available for programmatic use
Focus on contentLocked as the default, remove the 4-mode table, clarify that locking only affects end users not template authors.
Contributor
|
🎉 This PR is included in template-builder v1.3.0-next.25 The release is available on GitHub release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SuperDoc core already enforces SDT lock modes, but Template Builder never passed lockMode to the editor commands. This adds:
Closes SD-1866