feat: editor enriquecido en notas de Seguimiento

Barra tipo Docs (negrita, color, resaltado, listas, enlaces, tamaño) al crear notas.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-24 17:35:42 +02:00
parent 9f30aa6820
commit dd50251de2
3 changed files with 301 additions and 12 deletions

View File

@@ -105,7 +105,17 @@ export async function POST(req: NextRequest) {
: typeof body.note === 'string'
? body.note.trim()
: '';
if (!text) {
const plain = text
.replace(/<br\s*\/?>/gi, '\n')
.replace(/<\/(p|div|li|h[1-6])>/gi, '\n')
.replace(/<[^>]+>/g, '')
.replace(/&nbsp;/gi, ' ')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/\s+/g, ' ')
.trim();
if (!plain) {
return NextResponse.json({ error: 'Texto de la nota requerido' }, { status: 400 });
}
const title =
@@ -123,7 +133,7 @@ export async function POST(req: NextRequest) {
entry_type: 'note',
external_id: `manual-${randomUUID()}`,
title,
summary: text.slice(0, 280),
summary: plain.slice(0, 280),
body_md: text,
occurred_at: occurredRaw,
synced_at: new Date().toISOString(),