Templates and locking

How a templated document differs from a free one.

A template is a document blueprint that you (or someone else) reuses to start new documents. A template can be free — meaning the new document is just a duplicate that you can edit freely — or it can be locked, restricting which parts of the document the user is allowed to edit.

Locking matters in two situations:

  1. Standard operating procedures where the steps must run in a fixed order, with fixed reagents, but the operator fills in observations as they go.
  2. Regulated forms (IACUC submissions, GxP procedure runs) where the language is institutionally approved and must not be changed without re-approval.

The three lock states

Try each — the demo below is fully interactive:

Blocks fixed; text inside still editable.
  1. 1
  2. 2
  3. 3
  4. 4
Structure is locked. Text edits are still allowed — useful for templated SOPs where you want notes inline but no skipped steps.
Switch the lock mode at the top. The structure-locked mode is what most SOPs use.

Behind the scenes, locking has three independent layers, all stored in the document's real-time state:

enabled
Master switch. Off → no locking at all.
structureLocked
When true, blocks cannot be added, removed or reordered. Text content still editable unless overridden.
defaultTextLock
Default text-edit policy for paragraphs and headings. Either "locked" or "editable".
nodeLocks
Per-block overrides. A block can be marked "locked", "editable", or "partial" (some attribute fields editable, others not).

partial is what makes form-style templates possible. A protocol-step block can have body locked but observed_value editable; a registration-table block can have the schema locked but allow appending rows.

How a templated document differs from a free document

When you create a document from a template, the lock configuration travels with it. Three things happen:

  • The editor's slash menu hides forbidden insertions when structure is locked.
  • The document's outline and block IDs are pre-populated; lock state travels with the document and is preserved through every edit.
  • The server independently re-validates every save against the lock config — client-side enforcement is for UX, server-side enforcement is for trust.

Versioning

Templates are versioned. Editing a template creates a new version (v1, v2, …) with an optional changelog. Documents track which template they came from and which version, so you can prompt users when a newer version is available.

If you publish the template to dalea.market, each release is immutable; yanking marks a release as unsafe but doesn't delete it.

What's next