fix: note du jour — contenu HTML (pas JSON TipTap) + type richtext
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -15,13 +15,8 @@ function getTodayContent(dateStr: string): string {
|
|||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
}
|
}
|
||||||
const formatted = d.toLocaleDateString('fr-FR', options)
|
const formatted = d.toLocaleDateString('fr-FR', options)
|
||||||
return JSON.stringify({
|
// Store as HTML (same format as richtext notes via editor.getHTML())
|
||||||
type: 'doc',
|
return `<h1>📅 ${formatted}</h1><p></p>`
|
||||||
content: [
|
|
||||||
{ type: 'heading', attrs: { level: 1 }, content: [{ type: 'text', text: `📅 ${formatted}` }] },
|
|
||||||
{ type: 'paragraph', content: [{ type: 'text', text: '' }] },
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,7 +37,7 @@ export async function GET() {
|
|||||||
where: {
|
where: {
|
||||||
userId,
|
userId,
|
||||||
title: today,
|
title: today,
|
||||||
type: 'daily',
|
type: { in: ['richtext', 'daily'] },
|
||||||
trashedAt: null,
|
trashedAt: null,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -53,7 +48,7 @@ export async function GET() {
|
|||||||
userId,
|
userId,
|
||||||
title: today,
|
title: today,
|
||||||
content: getTodayContent(today),
|
content: getTodayContent(today),
|
||||||
type: 'daily',
|
type: 'richtext',
|
||||||
color: '#FEF9C3', // yellow-100 — distinguishes daily notes visually
|
color: '#FEF9C3', // yellow-100 — distinguishes daily notes visually
|
||||||
labels: JSON.stringify(['daily']),
|
labels: JSON.stringify(['daily']),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user