Form building and management for the publishing editor.
Handles form construction, normalization, slug tracking, and form state management.
Summary
Functions
Assigns form with tracking for slug auto-generation.
Converts a published_at value to datetime-local input format.
Detects whether the user manually set the title field. Returns {form, title_manually_set}.
Checks if the form has changes compared to the original post.
Floors a DateTime to the minute (sets seconds and microseconds to 0).
Updates slug from content if applicable. Returns {socket, new_form, slug_events}.
Updates the title from content if not manually set. Returns {socket, form, events}.
Normalizes a form map to ensure consistent values.
Builds a form map from a post.
Build form for a post, handling new translations appropriately.
Preserve auto-generated title when browser sends empty value.
Preserve auto-generated url_slug when browser sends empty value.
Push slug events to the client.
Reverts the title to the auto-extracted H1 heading. Returns {form, false}.
Updates form with selected media file.
Functions
Assigns form with tracking for slug auto-generation.
Converts a published_at value to datetime-local input format.
Detects whether the user manually set the title field. Returns {form, title_manually_set}.
Checks if the form has changes compared to the original post.
Floors a DateTime to the minute (sets seconds and microseconds to 0).
Updates slug from content if applicable. Returns {socket, new_form, slug_events}.
Updates the title from content if not manually set. Returns {socket, form, events}.
Normalizes a form map to ensure consistent values.
Builds a form map from a post.
Build form for a post, handling new translations appropriately.
For new translations (no content in DB yet), inherits status from the primary language. For existing files, uses the file's own status to avoid confusion between what the dropdown shows and what the language switcher shows.
Preserve auto-generated title when browser sends empty value.
Preserve auto-generated url_slug when browser sends empty value.
Push slug events to the client.
Reverts the title to the auto-extracted H1 heading. Returns {form, false}.
Updates form with selected media file.