Fix FAQFull: Use isDraft boolean for draft filtering, fix Kontakt ID override

This commit is contained in:
MichalC
2026-09-16 12:31:19 +02:00
parent 437e1e4823
commit 9043301da6
140 changed files with 23337 additions and 724 deletions
+33
View File
@@ -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)
}