Foro: editor rico ligero (barra de formato) en respuestas, temas y edición

- components/RichTextArea.tsx: barra de formato (negrita, cursiva, subrayado, tachado,
  enlace, cita, lista, código) que envuelve la selección del textarea en HTML;
  el HTML se sanea en el servidor con cleanPostHtml. Sin dependencias pesadas
  (evita CKEditor y no rompe el pipeline de saneado).
- Cableado en ReplyForm, NewTopicForm y PostActions (edición).
- i18n es/en: namespace Editor.

Verificado: build OK, /forum y home 200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-13 01:03:38 +00:00
parent 7c1cd195ff
commit 72fdead9f3
6 changed files with 121 additions and 4 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
import { useState } from 'react'
import { useTranslations } from 'next-intl'
import { useRouter } from '@/i18n/navigation'
import { RichTextArea } from './RichTextArea'
export function NewTopicForm({ forumId }: { forumId: number }) {
const t = useTranslations('Forum')
@@ -41,7 +42,7 @@ export function NewTopicForm({ forumId }: { forumId: number }) {
<form onSubmit={handleSubmit} className="mt-8 space-y-3 nw-card">
<h3 className="font-semibold text-amber-400">{t('newTopic')}</h3>
<input value={name} onChange={(e) => setName(e.target.value)} placeholder={t('newTopicName')} maxLength={200} className={field} />
<textarea value={text} onChange={(e) => setText(e.target.value)} placeholder={t('newTopicText')} rows={4} className={field} />
<RichTextArea value={text} onChange={setText} placeholder={t('newTopicText')} rows={4} />
<button type="submit" disabled={busy} className="nw-btn disabled:opacity-60">
{busy ? t('publishing') : t('publish')}
</button>