fix prod
This commit is contained in:
parent
053bd95d4a
commit
c1df50c49b
|
|
@ -533,9 +533,12 @@ export function sanitizeRecord(record: any): TLRecord {
|
||||||
sanitized.props.richText = cleanRichTextNaN(sanitized.props.richText)
|
sanitized.props.richText = cleanRichTextNaN(sanitized.props.richText)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CRITICAL: Fix richText structure for text shapes
|
// CRITICAL: Fix richText structure for text shapes - REQUIRED field
|
||||||
if (sanitized.type === 'text' && sanitized.props.richText) {
|
if (sanitized.type === 'text') {
|
||||||
if (Array.isArray(sanitized.props.richText)) {
|
// Text shapes MUST have props.richText as an object - initialize if missing
|
||||||
|
if (!sanitized.props.richText || typeof sanitized.props.richText !== 'object' || sanitized.props.richText === null) {
|
||||||
|
sanitized.props.richText = { content: [], type: 'doc' }
|
||||||
|
} else if (Array.isArray(sanitized.props.richText)) {
|
||||||
sanitized.props.richText = { content: sanitized.props.richText, type: 'doc' }
|
sanitized.props.richText = { content: sanitized.props.richText, type: 'doc' }
|
||||||
} else if (typeof sanitized.props.richText === 'object' && sanitized.props.richText !== null) {
|
} else if (typeof sanitized.props.richText === 'object' && sanitized.props.richText !== null) {
|
||||||
if (!sanitized.props.richText.type) sanitized.props.richText = { ...sanitized.props.richText, type: 'doc' }
|
if (!sanitized.props.richText.type) sanitized.props.richText = { ...sanitized.props.richText, type: 'doc' }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue