feat(14.2.1-03): add markdown and multilingual cabana fields

Lift locale maps before ProjectWritableFields so a Journal-shaped save can persist the default host scalar and non-default locales through TranslationWriter without dropping nested JSON.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-06 12:32:54 +02:00
parent 234111d245
commit a04116d41f
13 changed files with 895 additions and 3 deletions

View File

@@ -2,8 +2,11 @@
// filtering, the save payload, 422 detail mapping and focus.
import type { AdminRecord, ErrorBody, FormField } from '../../api/types'
import { permissionValues } from './control'
import { localeRecord } from './mlLocale'
import { isRegistered } from './registry'
export { ML_LOCALE_CHANGE, broadcastMLLocale, localeRecord } from './mlLocale'
/** The screen a field is filtered for: the two form modes and the read-only preview (D-11). */
export type FormMode = 'create' | 'update' | 'preview'
@@ -62,6 +65,10 @@ export function editablePayload(fields: FormField[], values: AdminRecord, mode:
out[field.name] = permissionValues(field, value)
continue
}
if (field.type === 'mltext' || field.type === 'mlmarkdown') {
out[field.name] = localeRecord(value)
continue
}
if (value !== undefined) {
out[field.name] = value
}
@@ -95,6 +102,8 @@ export function initialValues(fields: FormField[]): AdminRecord {
out[field.name] = false
} else if (field.type === 'relation' && field.multiple) {
out[field.name] = []
} else if (field.type === 'mltext' || field.type === 'mlmarkdown') {
out[field.name] = {}
}
}
return out