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:
@@ -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(/ /gi, ' ')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/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(),
|
||||
|
||||
Reference in New Issue
Block a user