You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(template-builder): wire lockMode through field insertion paths (#2721)
* feat(template-builder): wire lockMode through field insertion paths
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
* fix(template-builder): include lockMode in field equality check
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.
* docs(template-builder): add lockMode and defaultLockMode
Documents field locking in configuration guide and API reference.
* feat(template-builder): add lock mode selector to field creation form
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.
* fix(template-builder): respect lock mode in delete and show lock badge
- 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
* refactor(template-builder): simplify lock UI to a checkbox
- 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
* docs(template-builder): simplify lock mode documentation
Focus on contentLocked as the default, remove the 4-mode table,
clarify that locking only affects end users not template authors.
Copy file name to clipboardExpand all lines: apps/docs/solutions/template-builder/configuration.mdx
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,26 @@ Allow users to create new fields while building templates:
110
110
111
111
When enabled, the field menu shows a "Create New Field" option with inputs for name, mode (inline/block), and field type (owner/signer).
112
112
113
+
### Field locking
114
+
115
+
Make fields read-only so end users can't edit their content:
116
+
117
+
```tsx
118
+
<SuperDocTemplateBuilder
119
+
defaultLockMode="contentLocked"
120
+
fields={{
121
+
available: [
122
+
{ id: "1", label: "Customer Name" },
123
+
{ id: "2", label: "Notes", lockMode: "unlocked" }, // this one stays editable
124
+
],
125
+
}}
126
+
/>
127
+
```
128
+
129
+
Per-field `lockMode` overrides `defaultLockMode`. The default field creation form includes a "Locked" checkbox that sets `contentLocked`.
130
+
131
+
Template authors can always delete and manage fields regardless of lock mode — locking only affects end users interacting with the document. For advanced use cases, see [lock modes](/extensions/structured-content#lock-modes).
132
+
113
133
### Linked fields
114
134
115
135
When a user selects an existing field from the "Existing Fields" section in the menu, a linked copy is inserted. Both instances share a group ID and stay in sync.
0 commit comments