Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/features/data-workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ isLabelLocked(field, table) // true for built-in postType fields and sys
deleteTooltip(field, table) // disabled-button tooltip text, or undefined
```

Built-in field **values** (row cells) are additionally read-only on the *structural* system tables (pages/components/layouts) via `isBuiltInValueLocked` (`@core/data/systemTableGuard`); `posts` built-in values stay editable. The same predicate backs the server's row-write rejection (`lockedBuiltInCellKey`).
Built-in field **values** (row cells) stay editable on existing records everywhere, including the *structural* system tables (pages/components/layouts). The one remaining value lock is at **create** time: `protectedBuiltInCreateCellKey` (`@core/data/systemTableGuard`) rejects a create that supplies built-in cells for a structural system table, so those rows are born through their own authoring surfaces rather than the generic row endpoint. `posts` is exempt (`kind === 'postType'`), and the server enforces this in `server/handlers/cms/data/tables.ts`.

`FIELD_TYPE_LABELS` maps every `DataFieldType` to a human-readable string and
is shared by `FieldRow` and `FieldSchemaComposer`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ function button(): HTMLButtonElement {
}

describe('PageTreeCell', () => {
// A `pageTree` cell on a system table is ALWAYS readOnly — every built-in
// field of `pages` / `components` / `layouts` is value-locked. The button
// navigates to the visual editor rather than editing the cell, so gating it
// on readOnly disabled it on exactly the rows it exists for.
// A `pageTree` cell is never editable inline — the tree is authored in the
// visual editor, not typed into a cell. The button navigates to that editor
// rather than editing the cell, so gating it on readOnly disabled it on
// exactly the rows it exists for.
it('stays enabled on a read-only cell when a handler is wired', async () => {
let opened = 0
renderCell({ readOnly: true, onOpenEditor: () => { opened += 1 } })
Expand Down
10 changes: 5 additions & 5 deletions src/admin/pages/data/components/DataGrid/cells/PageTreeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* pattern that `RelationCell` uses for `onOpenPicker`.
*
* `readOnly` deliberately does NOT gate the button. It means "this value is
* not editable in the grid", which is always true for a `pageTree` cell on a
* system table (`isBuiltInValueLocked` holds for every built-in field of
* `pages` / `components` / `layouts`). The button edits nothing — it navigates
* to the visual editor, which enforces its own permissions. Gating it on
* `readOnly` disabled it on exactly the rows it exists for.
* not editable inline in the grid", which a `pageTree` cell never is — the
* tree is authored in the visual editor, not typed into a cell. The button
* edits nothing, it navigates to that editor, which enforces its own
* permissions. Gating it on `readOnly` disabled it on exactly the rows it
* exists for.
*/
import type { ReactElement } from 'react'
import { Button } from '@ui/components/Button'
Expand Down
Loading