Fix FAQFull: Use isDraft boolean for draft filtering, fix Kontakt ID override
This commit is contained in:
@@ -10,6 +10,37 @@ const cleanData = (data: any) => {
|
||||
return rest
|
||||
}
|
||||
|
||||
function toLexicalParagraph(text: unknown) {
|
||||
if (typeof text !== 'string') return text;
|
||||
return {
|
||||
root: {
|
||||
type: 'root',
|
||||
format: '',
|
||||
indent: 0,
|
||||
version: 1,
|
||||
children: [
|
||||
{
|
||||
type: 'paragraph',
|
||||
format: '',
|
||||
indent: 0,
|
||||
version: 1,
|
||||
children: [
|
||||
{
|
||||
mode: 'normal',
|
||||
text: text,
|
||||
type: 'text',
|
||||
style: '',
|
||||
detail: 0,
|
||||
format: 0,
|
||||
version: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Deep replace page IDs in globals and nullify missing media relations
|
||||
const mapRelations = (obj: any, idMap: Map<number, number>): any => {
|
||||
if (Array.isArray(obj)) {
|
||||
@@ -24,6 +55,8 @@ const mapRelations = (obj: any, idMap: Map<number, number>): any => {
|
||||
newObj[key] = idMap.get(obj[key]) || obj[key]
|
||||
} else if (key === 'homepage' && typeof obj[key] === 'number') {
|
||||
newObj[key] = idMap.get(obj[key]) || obj[key]
|
||||
} else if (obj.blockType === 'TextSection' && key === 'text') {
|
||||
newObj[key] = toLexicalParagraph(obj[key])
|
||||
} else {
|
||||
newObj[key] = mapRelations(obj[key], idMap)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user