Skip to content

feat(content): edit custom data-table fields in the content settings panel#182

Draft
DavidBabinec wants to merge 1 commit into
mainfrom
feat/content-item-custom-fields
Draft

feat(content): edit custom data-table fields in the content settings panel#182
DavidBabinec wants to merge 1 commit into
mainfrom
feat/content-item-custom-fields

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

What changed

The Content workspace settings panel now exposes custom data-table columns as editable fields, alongside the built-in entry fields (slug, status, author, featured media, SEO meta). Previously, custom columns added to the posts/pages tables could only be edited in the Data workspace grid.

  • defaultCellValue (src/core/data/cells.ts) centralizes per-type empty cell values, shared by the DataGrid and the new panel editors.
  • useContentEntryDraft carries a customCells record — hydration, dirty tracking, and save payloads now include custom columns. Rename/duplicate drafts snapshot custom cells so they survive those flows.
  • ContentCustomFields renders one editor per editable custom column: Input for text/number/date/datetime, Switch for boolean, Select for select, textarea for json, media picker via FileUpload, and RelationPickerDialog for relation columns. Lazy-loaded so the heavy editor graph stays out of the initial ContentPage chunk (initial chunk grows only ~1 kB over base, within the bundle budget).
  • useRelationTargetRows resolves relation row ids to human-readable target-row labels.
  • Built-in-only columns (pageTree, fieldSchema) and built-in fields are excluded.

Why

Custom fields on content tables were invisible in the Content workspace — users had to switch to the Data workspace to edit them, breaking the writing flow.

Impact

  • Users: custom columns are directly editable in the Content settings sidebar; values round-trip through save/reload, rename, and duplicate.
  • Developers: defaultCellValue is the single source of per-type empty values; new cell types plug in there.

Verification

  • bun test (full suite, including 3 new test files: cell defaults, draft hook, panel component)
  • bun run build (tsc + vite, bundle-size budget test passing)
  • bun run lint
  • Browser smoke test on the e2e stack: seeded five custom columns (text, date, boolean, select, relation) on posts; edited values in the sidebar, saved draft, reloaded — all values persisted and rehydrated.

🤖 Generated with Claude Code

…panel

The Content workspace settings panel previously exposed only the built-in
entry fields (slug, status, author, featured media, SEO meta). Custom
columns added to the posts/pages data tables were invisible there — they
could only be edited in the Data workspace grid.

- `defaultCellValue` in `src/core/data/cells.ts` centralizes per-type
  empty values (shared by the grid and the new panel editors)
- `useContentEntryDraft` carries a `customCells` record; dirty tracking,
  hydration, and save payloads include custom columns
- `ContentCustomFields` (lazy-loaded to keep the ContentPage chunk within
  its bundle budget) renders one editor per custom column: Input for
  text/number/date/datetime, Switch for boolean, Select for select,
  CodeMirror-free textarea for json, FileUpload-backed picker for media,
  and a RelationPickerDialog for relation columns
- `useRelationTargetRows` resolves relation ids to target-row labels for
  display
- rename/duplicate drafts snapshot custom cells so they survive those flows
- docs: content-workspace.md + content-storage.md updated

Verified with bun test, bun run build, bun run lint, and a browser smoke
test (seeded five custom columns on posts; edited, saved, reloaded — all
values persisted and rehydrated).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant