fix: notas Seguimiento Semanal con HTML completo, enlaces y formato
Exporta el Google Doc en HTML, parte por fecha y guarda todo el bloque (listas, negritas, links) sin truncar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,6 +48,18 @@ function typeTone(t: string) {
|
||||
return 'bg-violet-50 text-violet-800 border-violet-200';
|
||||
}
|
||||
|
||||
function looksLikeHtml(s: string) {
|
||||
return /<\/?(?:ul|ol|li|p|a|strong|br)\b/i.test(s);
|
||||
}
|
||||
|
||||
function escapeHtml(s: string) {
|
||||
return s
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
export default function SeguimientoBoard() {
|
||||
const [data, setData] = useState<Payload | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -319,9 +331,18 @@ export default function SeguimientoBoard() {
|
||||
)}
|
||||
</div>
|
||||
{open && e.body_md && (
|
||||
<pre className="mt-3 whitespace-pre-wrap text-xs text-gray-700 bg-gray-50 border border-gray-100 rounded-lg p-3 max-h-64 overflow-y-auto font-sans">
|
||||
{e.body_md}
|
||||
</pre>
|
||||
<div
|
||||
className="mt-3 text-sm text-gray-800 bg-gray-50 border border-gray-100 rounded-lg p-4 max-h-[36rem] overflow-y-auto [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li]:my-0.5 [&_a]:text-brand-600 [&_a]:underline [&_strong]:font-semibold [&_p]:my-1.5"
|
||||
onClick={(ev) => {
|
||||
const t = ev.target as HTMLElement;
|
||||
if (t.closest('a')) ev.stopPropagation();
|
||||
}}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: looksLikeHtml(e.body_md)
|
||||
? e.body_md
|
||||
: `<pre class="whitespace-pre-wrap font-sans m-0 text-xs">${escapeHtml(e.body_md)}</pre>`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user