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

@@ -0,0 +1,24 @@
/** Window event that keeps every ML control on one active locale. */
export const ML_LOCALE_CHANGE = 'summer:ml-locale'
/** Broadcast the locale the administrator selected on any ML control. */
export function broadcastMLLocale(locale: string): void {
if (typeof window === 'undefined' || locale === '') {
return
}
window.dispatchEvent(new CustomEvent(ML_LOCALE_CHANGE, { detail: locale }))
}
/** Locale → text map as it is sent on save: only string values. */
export function localeRecord(value: unknown): Record<string, string> {
const out: Record<string, string> = {}
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
return out
}
for (const [locale, text] of Object.entries(value as Record<string, unknown>)) {
if (typeof text === 'string') {
out[locale] = text
}
}
return out
}