Editor forms described by the server, with field checks on focus lost #164
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle#164
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The browser stops knowing field types. For every form it asks the server which fields the form has, each with its label, widget, widget settings, required flag and current value, already read through the field-type definitions from #163, and renders widgets from that. Errors come only from the server: from a field-check endpoint when a field loses focus, and from every save. Element params are read on the server like page fields, so a hand-written date in an element no longer blocks its save (#158).
Current behavior
GET /api/page/settingsreturns{fields, values}, with the values read on the server.GET /api/elements,GET /api/pagetypes) plus raw values:FormPane.tsx) take values from the page tree, whichGET /api/pageand every page-changing response return as a plain parse of the file;ChipDialoginweb/src/rte/RichTextField.tsx) takes params the browser parses out of the body markdown (web/src/rte/chip.ts);CreateDialog.tsx) starts from schema defaults, and from the current time for adatetimefield.web/src/api/types.ts), seeding (initialFieldValue), checks (validateFieldValues,isRFC3339), building saved values (buildFieldValues, which for inline elements also joins categories with commas), the link's<name>Targetcompanion (five files), read-only display (readonlyValueText), the module list's cells (ModuleScreen.tsx) and its sort rule (SORTABLE_TYPESinweb/src/modulequery.ts).start="2026-07-10"in an element'sdatetimeparam reaches the form unread. The browser's RFC3339 check rejects it ("Must be a valid date and time") even though the picker shows the date, and that blocks saving any field of the element (in an item row, its parent element) until the date is entered again. The same happens with2026-07-10 09:00:00,2026-07-10T09:00:00and10 Jul 2026. No shipped element has adatetimeparam, but custom elements can.{errors: [{param, msg}]}, properties saves return{fields: {name: msg}}, and page create returns only its first error, as text.Desired behavior
datetimefield in the create dialog still starts at the current time.items[<i>].<name>.<name>plus<name>Target.datetimeshortcode param, like front matter, may be written in any spelling Hugo reads, and that the editor writes RFC3339 (itsdatetimeparagraph and "Editing content by hand").Decisions
typeandrenderType. Each type definition names its widget and the widget's settings. Changing a rule touches only Go, changing a widget touches only the browser, and only a type that needs new UI touches both.Key interfaces
GET /api/page/settings(handlePageSettingsininternal/server/pageops.go), the model to generalize;GET /api/elements,GET /api/pagetypes,GET /api/modules,GET /api/module/entries,GET /api/element/body; the savesPOST /api/page/save,POST /api/page/settings/saveandPOST /api/page/create.web/src/components/fields.tsx,FormPane.tsx,PageSettings.tsx,CreateDialog.tsx,EntryEditor.tsx,ModuleScreen.tsx,web/src/rte/RichTextField.tsx,web/src/rte/chip.ts,web/src/modulequery.ts,web/src/api/types.ts.Acceptance criteria
start="2026-07-10","2026-07-10 09:00:00","2026-07-10T09:00:00"and"10 Jul 2026"in a block element's, an item row's and an inline element'sdatetimeparam show in the form and save without being touched. The file then holds the same instant, as RFC3339. (#158)datetimeshortcode params (CLAUDE.md rule).make testpasses.How to verify
make test, with Go tests for each form kind's description, the field check for each type, and the error format, and browser tests for the widgets and for forms rendered from mocked descriptions.harness serve(the repo's playwright-core + nix Chromium recipe), on a site with an element sidecar that declares adatetimeparam and an inline element that has one:Assumptions to check
Out of scope
renderType), and new field types.timeZone.Blocked by